Get physical map location of object based off user input

£可爱£侵袭症+ 提交于 2019-12-08 05:46:06

问题


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.


回答1:


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)



回答2:


You can use geopy (http://code.google.com/p/geopy/wiki/GettingStarted). It can query Google and several additional services.




回答3:


I have a JQuery Plugin that will allow you to plot multiple addresses from a json object. In my demo, I load the json object from a php file, so I'm sure that you can do the same with python.

http://grasshopperpebbles.com/ajax/jquery-plugin-imgooglemaps-0-9-multiple-addresses-street-view/



来源:https://stackoverflow.com/questions/1851722/get-physical-map-location-of-object-based-off-user-input

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!