def hand(poidate):
name = poidate["name"] if 'name' in poidate.keys() else ""
lon = poidate["x"]/100
lat = poidate["y"]/100
lon_bd09,lat_bd09 =ChangeCoord().db09mc_to_bd09(float(lon),float(lat))
lon_84,lat_84 =ChangeCoord().bd09mc_to_wgs84(float(lon),float(lat))
# return {'poi名称':name,'经度':lon_84,'纬度':lat_84}
return [name,lon_84,lat_84]
def writecsv():
df_stats = pd.DataFrame(df_stats)
df_stats.to_csv(exceloutputfilename, index=False, header=['原名称','poi名称', '经度', '纬度'],mode="w")
# df_stats = df_stats.append(columns, ignore_index=True)
return df_stats
def Savecsv(df_stats):
# 创建ExcelWriter对象
df_stats = pd.DataFrame(df_stats)
# 将DataFrame导出到Excel文件
df_stats.to_csv(exceloutputfilename, index=False,mode="a")
def hand(poidate):
name = poidate["name"] if 'name' in poidate.keys() else ""
lon = poidate["x"]/100
lat = poidate["y"]/100
lon_bd09,lat_bd09 =ChangeCoord().db09mc_to_bd09(float(lon),float(lat))
lon_84,lat_84 =ChangeCoord().bd09mc_to_wgs84(float(lon),float(lat))
# return {'poi名称':name,'经度':lon_84,'纬度':lat_84}
return [name,lon_84,lat_84]
if __name__ == "__main__":
df_stats=[]
poilist = hand(poidata)
# poilist['原名称']=word
poilist.insert(0,word)
# 2、excel写入数据
df_stats.append(poilist)
# 3、excel保存
if count==1:
Savecsv(df_stats,"w")
else:
Savecsv(df_stats,"a")