如何使用 Google Map Feed API 使用 Python 获取我的 Google 地图列表?
我想用 Python 创建一个脚本,用于下载我在 Google 地图上创建的所有地图的当前 KML 文件。
要手动执行此操作,我可以使用以下命令:
http://maps.google.com.br/maps/ms?msid=USER_ID.MAP_ID&msa=0&output=kml
其中 USER_ID
是 Google 用于识别我身份的常数,MAP_ID
是由 链接生成的单独地图标识符右上角的
图标。
这不是很简单,因为我必须手动浏览Google地图上的“我的地点”页面,并一一获取链接。
地图源是用户创建的地图的源。
此 Feed 的完整 GET URI 为:
http://maps.google.com/maps/feeds/maps/默认/完整
此提要返回经过身份验证的用户的所有地图的列表。
** 该页面说该服务不再可用,所以我想知道目前是否有办法做同样的事情。
所以,问题是:有没有办法获取/下载我所有地图的 MAP_ID 列表,最好使用 Python?
感谢您的阅读
I want to create a script in Python which downloads the current KML files of all the Maps I created on Google Maps.
To do so manually, I can use this:
http://maps.google.com.br/maps/ms?msid=USER_ID.MAP_ID&msa=0&output=kml
where USER_ID
is a constant number Google uses to identify me, and MAP_ID
is the individual map identifier generated by the link
icon on top-right corner.
This is not very straightforward, because I have to manually browse "My Places" page on Google Maps, and get the links one by one.
From Google Maps API HTTP Protocol Reference:
The Map Feed is a feed of user-created maps.
This feed's full GET URI is:
http://maps.google.com/maps/feeds/maps/default/full
This feed returns a list of all maps for the authenticated user.
** The page says this service is no longer available, so I wonder if there is a way to do the same in the present.
So, the question is: Is there a way to get/download the list of MAP_IDs of all my maps, preferrably using Python?
Thanks for reading
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这个问题的正确答案涉及使用 Google Maps Data API、HTML 接口,顺便说一下,它已被弃用,但仍然以更正式的方式解决了我的需求,或者至少比解析网页更有说服力。事情是这样的:
我带着这个解决方案来到了 SO,还有很多其他问题,很多人给了我很多帮助,所以我希望这段代码可以帮助任何其他人将来尝试这样做。
The correct answer to this question involves using Google Maps Data API, HTML interface, which by the way is deprecated but still solves my need in a more official way, or at least more convincing than parsing a web page. Here it goes:
I arrived with this solution with a bunch of other questions in SO, and a lot of people helped me a lot, so I hope this code might help anyone else trying to do so in the future.
我发现的一种快速而肮脏的方法,完全跳过 Google Maps API,也许在不久的将来可能会停止,是这样的:
当然,它只是打印编号列表,但从那里保存字典和/或自动 KML 下载通过
&output=kml
url 技巧,一切都很自然。A quick and dirty way I have found, that skips Google Maps API completely and perhaps might brake in the near future, is this:
Of course it is only printing a numbered list, but from there to save a dictionary and/or automate KML download via
&output=kml
url trick it goes naturally.