简体   繁体   English

从纬度和经度创建名称为 City 的新列 [on hold]

[英]Create new column with name of City from Latitude and Longitude [on hold]

I have the following problem, I need to create a column with the name of the City but I only have the values of longitude and latitude in Python.我有以下问题,我需要创建一个名为 City 的列,但我只有 Python 中的经度和纬度值。

What would you recommend me to use?你会推荐我用什么?

Thanks!谢谢!

Yes you can do it with the help of Google Maps Api, request example is below:是的,你可以在谷歌地图 Api 的帮助下完成,请求示例如下:

https://maps.googleapis.com/maps/api/geocode/json?latlng=40.714224,-73.961452&key=YOUR_API_KEY

Official Tutorail go for Example of Reverse Geocoding section. 官方 Tutorail go 作为反向地理编码部分的示例。

After you get all answers from Google API and find Place names there, put them in a list, then do:从 Google API 获得所有答案并在那里找到地名后,将它们放入列表中,然后执行以下操作:

df["NewColumn"] = the list

Hope it was useful for you, happy coding!希望它对您有用,祝您编码愉快!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM