【发布时间】:2018-11-14 09:27:11
【问题描述】:
我使用Google's Map API 从 Python 中提取纬度和经度坐标的地址信息。如下代码所示,有一个名为osm_type 的属性我认为是“开放街道地图类型”。但是,当我在谷歌上搜索文档时,我发现只有“类型”,而我发现的所有列表都不包括“方式”作为预期的类型答案之一。有谁知道我在哪里可以获得对osm_type 有效的类型列表?
代码:
from geopy.geocoders import Nominatim
geolocator = Nominatim()
from geopy.exc import GeocoderTimedOut
import time
lat = 43.2335233435383
lon = -70.9108497973799
location = geolocator.reverse(str(lat) + ", " + str(lon), timeout=10)
print(location.raw)
输出:
{'address': {'city': 'Dover',
'country': 'United States of America',
'country_code': 'us',
'county': 'Strafford County',
'house_number': '155',
'postcode': '03820',
'road': 'Long Hill Road',
'state': 'New Hampshire'},
'boundingbox': ['43.233423343538',
'43.233623343538',
'-70.91094979738',
'-70.91074979738'],
'display_name': '155, Long Hill Road, Dover, Strafford County, New Hampshire, 03820, United States of America',
'lat': '43.2335233435383',
'licence': 'Data © OpenStreetMap contributors, ODbL 1.0. https://osm.org/copyright',
'lon': '-70.9108497973799',
'osm_id': '18868744',
'osm_type': 'way',
'place_id': '201786637'}
【问题讨论】:
-
我似乎重复了你的问题。帮助文档列出了“type”而不是“osm_type”,并且没有列出“way”。 API中是否有可能发生了变化,osm_type被记录为“类型”,而“方式”要么是数据错误,要么被贬低但未在贬低部分列出?请参阅此网址:developers.google.com/places/supported_types
标签: python-3.x google-maps-api-3