您可能已經非常瞭解地理編碼器(請參閱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 –