基于用户输入获取物体的物理地图位置 [英] Get physical map location of object based off user input
问题描述
我将用户输入到本地地标的Python应用程序中。有了这些数据,我试图使用Google地图来获取它们对象的经度和纬度。我正在尝试使用Google gdata API来处理地图,但是我没有找到一种方法在使用python时从搜索查询中获取长时间和纬度数据。
我可以使用任何系统用python解决我的问题。
您是否想要对街道或POI(兴趣点)进行地理编码?在这种情况下, geopy 是完美的:
< pre $
In [1]:from geopy import geocoders
In [2]:g = geocoders.Google(GOOGLE_MAPS_API_KEY)
In [3]:(place,point)= g.geocode('巴黎艾菲尔铁塔')
获取http://maps.google.com/maps/geo?q=Eiffel+Tower%2C+Paris&输出= kml& key = XYZ ...
在[4]中:打印点
------>打印(点)
(48.858204999999998,2.294359)
I am getting user input into a python application of a local landmark. With this data I am trying to get the longitude and latitude of their object using Google maps. I am trying to work with the Google gdata api for the maps but I did not find a way to get long and lat data from a search query when working in python.
I am ok using any system that will solve my problem in python.
Are you trying to geocode a street or POI (point of interest)? In that case, geopy is perfect:
In [1]: from geopy import geocoders
In [2]: g = geocoders.Google(GOOGLE_MAPS_API_KEY)
In [3]: (place, point) = g.geocode('Eiffel Tower, Paris')
Fetching http://maps.google.com/maps/geo?q=Eiffel+Tower%2C+Paris&output=kml&key=XYZ...
In [4]: print point
------> print(point)
(48.858204999999998, 2.294359)
这篇关于基于用户输入获取物体的物理地图位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!