使用Python,是否有函数、库或其他方法可以检查某个经度/经度坐标对是否落入定义的地理边界内?
示例:
32.781065,-96.797117在德克萨斯州吗?
发布于 2015-06-04 22:52:14
您可以使用reverse geocode库,然后检查"admin1“区域是否为特定的美国州。
它将经度/经度坐标转换为如下字典:
{
'name': 'Mountain View',
'cc': 'US',
'lat': '37.38605',
'lon': '-122.08385',
'admin1': 'California',
'admin2': 'Santa Clara County'
}
发布于 2018-05-18 07:15:12
您可以使用可以使用pip install geocoder
安装的geocoder library。
import geocoder
results = geocoder.google('32.781065, -96.797117', reverse = True)
print(results.current_result.state_long)
发布于 2014-07-29 12:25:39
我将使用requests library向Google geocoding API发送请求。
https://stackoverflow.com/questions/25008191
复制相似问题