基于用户输入获取物体的物理地图位置 [英] Get physical map location of object based off user input

查看:157
本文介绍了基于用户输入获取物体的物理地图位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将用户输入到本地地标的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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆