您可能已经非常了解地理编码器(请参阅http://geopy.readthedocs.io/en/latest/#module-geopy.geocoders)。它提供对与此相关的各种服务的统一访问。文档(https://media.readthedocs.org/pdf/geopy/latest/geopy.pdf)在第47页列出了它们。我不知道哪个可能比您使用的更快。然而,考虑到你的任务的规模,他们可能值得调查。此代码旨在提供所提供的第一个剪辑。
import geopy.geocoders
import inspect
import string
serviceNames = [_[0] for _ in inspect.getmembers(geopy.geocoders) \
if not _[0].startswith('__')
and _[0][0] in string.ascii_uppercase
]
print (serviceNames)
for serviceName in serviceNames:
try:
exec('geolocator = geopy.geocoders.%s()' % serviceName)
except:
print (serviceName, 'requires access code, or not intended for this purpose')
continue
try:
result = geolocator.reverse('43.2,65.4')
print (serviceName, str(result).encode('ascii', 'ignore'))
except:
print (serviceName, 'reverse unsupported?')
continue
我的假设是只有以大写字母开头的成员才代表服务。这是输出。
['ArcGIS', 'Baidu', 'Bing', 'DataBC', 'GeoNames', 'GeocodeFarm', 'GeocoderDotUS', 'GeocoderNotFound', 'GoogleV3', 'IGNFrance', 'LiveAddress', 'NaviData', 'Nominatim', 'OpenCage', 'OpenMapQuest', 'Photon', 'SERVICE_TO_GEOCODER', 'What3Words', 'YahooPlaceFinder', 'Yandex']
ArcGIS reverse unsupported?
Baidu requires access code, or not intended for this purpose
Bing requires access code, or not intended for this purpose
DataBC reverse unsupported?
GeoNames requires access code, or not intended for this purpose
GeocodeFarm reverse unsupported?
GeocoderDotUS reverse unsupported?
GeocoderNotFound reverse unsupported?
GoogleV3 b'[Location(Tamdy District, Uzbekistan, (42.54183, 65.2488422, 0.0)), Location(Navoiy Province, Uzbekistan, (42.6988575, 64.6337685, 0.0)), Location(Uzbekistan, (41.377491, 64.585262, 0.0))]'
IGNFrance requires access code, or not intended for this purpose
LiveAddress requires access code, or not intended for this purpose
NaviData reverse unsupported?
Nominatim b'Tomdi Tumani, Navoiy Viloyati, Ozbekiston'
OpenCage requires access code, or not intended for this purpose
OpenMapQuest reverse unsupported?
Photon reverse unsupported?
SERVICE_TO_GEOCODER requires access code, or not intended for this purpose
What3Words requires access code, or not intended for this purpose
YahooPlaceFinder requires access code, or not intended for this purpose
Yandex b'[Location(, , (42.052267, 65.243642, 0.0)), Location(, (42.004874, 64.330882, 0.0)), Location(None, (41.765066, 63.150118, 0.0))]'
GoogleV3和Nominatim做你没有进一步携带的东西。如果结果显示“需要访问代码,或者不需要访问代码”,通常这意味着您需要密钥或登录信息。
http://stackoverflow.com/questions/16497384/google-maps-api-geocoding-handling-multiple-requests –