Google 地点 API 的搜索结果不准确(地理编码)
Inaccurate search result from Google place API (Geocoding)
我正在尝试对菲律宾的一些地址进行地理编码,但是当我通过 Google API 进行搜索时,我只得到非常不准确的结果(距离我正在寻找的点 10 公里因为 while maps.google.com 提供了更好的结果,大约有几百米的误差)。
在阅读了此处的其他帖子后(并测试了 Google 地图 API 和 Google 地点 API),似乎 maps.google.com 是基于Google Place so that should be the option to implement... 但是,我仍然得到一个列表,其中列出了与我要查找的地址并不真的很近的地方。
我的电话是这样的:
address="Balay Expo Centro Building, EDSA corner McArthur Avenue, Araneta Center, Cubao, Quezon City, Metro Manila, Philippines"
google_places = GooglePlaces(API_KEY)
query_result = google_places.nearby_search(
location = address,
radius=5)
for place in query_result.places:
print place.name
print place.geo_location
有谁知道如何提高精度?
您是否尝试过使用网络服务api?如果 Web 服务 api 更精确,您可以在应用程序中使用 json-解析器。
您似乎在使用 Nearby Search when you should be using Text Search。我在这里链接了 Places API 网络服务指南,因为它解释了这两种搜索之间的区别。
由于您似乎在使用 python-google-places,因此(我认为)它是这样工作的:
address = "Balay Expo Centro Building, EDSA corner McArthur Avenue, Araneta Center, Cubao"
user_location = "14.617766,121.057154" # Cubao
google_places = GooglePlaces(API_KEY)
query_result = googlemaps.places(
query = address,
lat_lng = user_location,
radius=500)
实际上,lat_lng
和 radius
是可选的,但如果将它们设置为合理的值以反映用户所在的位置,结果可能会更好。
我正在尝试对菲律宾的一些地址进行地理编码,但是当我通过 Google API 进行搜索时,我只得到非常不准确的结果(距离我正在寻找的点 10 公里因为 while maps.google.com 提供了更好的结果,大约有几百米的误差)。
在阅读了此处的其他帖子后(并测试了 Google 地图 API 和 Google 地点 API),似乎 maps.google.com 是基于Google Place so that should be the option to implement... 但是,我仍然得到一个列表,其中列出了与我要查找的地址并不真的很近的地方。
我的电话是这样的:
address="Balay Expo Centro Building, EDSA corner McArthur Avenue, Araneta Center, Cubao, Quezon City, Metro Manila, Philippines"
google_places = GooglePlaces(API_KEY)
query_result = google_places.nearby_search(
location = address,
radius=5)
for place in query_result.places:
print place.name
print place.geo_location
有谁知道如何提高精度?
您是否尝试过使用网络服务api?如果 Web 服务 api 更精确,您可以在应用程序中使用 json-解析器。
您似乎在使用 Nearby Search when you should be using Text Search。我在这里链接了 Places API 网络服务指南,因为它解释了这两种搜索之间的区别。
由于您似乎在使用 python-google-places,因此(我认为)它是这样工作的:
address = "Balay Expo Centro Building, EDSA corner McArthur Avenue, Araneta Center, Cubao"
user_location = "14.617766,121.057154" # Cubao
google_places = GooglePlaces(API_KEY)
query_result = googlemaps.places(
query = address,
lat_lng = user_location,
radius=500)
实际上,lat_lng
和 radius
是可选的,但如果将它们设置为合理的值以反映用户所在的位置,结果可能会更好。