gpt4 book ai didi

google-fusion-tables - 从 KML 融合表导出的经/纬度 - 任何方式?

转载 作者:行者123 更新时间:2023-12-01 10:52:10 24 4
gpt4 key购买 nike

有没有办法从 Fusion Tables KML 导出中获取经/纬度坐标?

这是一篇关于它的帖子,但该过程不再有效:

http://mickschroeder.com/2011/03/fusion-tables-export/

最佳答案

如果您的数据是用纬度/经度编码的,您将在导出中得到纬度/经度(以 <coordinates> 元素的形式)。如果您的数据是按地址编码的(我怀疑它在您的情况下),无法直接在导出中获取坐标。相反,KML 文件将包含一个 <address> 元素。Google 似乎会即时进行地址地理编码,但不愿意与您分享。

Google 有一个 geocoding API在您将在 Google map 上显示地理编码数据的情况下,您可以使用将您的地址转换为坐标。下面是一个在 Python 中使用地理编码 API 的简单示例:

import urllib2, json

# create a request URI for the Google Geocoding API
service_fmt = "https://maps.googleapis.com/maps/api/geocode/json?address={0}&sensor=false"
request_addr = service_fmt.format(urllib2.quote("600 Mountain Ave, New Providence, NJ"))

# make the request and deserialize the JSON response
response_handle = urllib2.urlopen(request_addr)
response = json.loads(response_handle.read())

print(response["results"][0]["geometry"]["location"])

关于google-fusion-tables - 从 KML 融合表导出的经/纬度 - 任何方式?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17778596/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com