通过Google Maps API v3查询现有的公开Goog​​le Map [英] Query existing, public Google Map via the Google Maps API v3

查看:215
本文介绍了通过Google Maps API v3查询现有的公开Goog​​le Map的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图将现有的公开Goog​​le Map嵌入到网站中。特别是这一个:
http://goo.gl/maps/cHf2



当然,我可以使用iframe嵌入来实现此目的,但是我希望对地图进行更多的控制......我想象能够从地图中拉出所有标记并显示它们作为地图旁边的索引。有点像谷歌已经做的,但嵌入在我的网页与我自己的风格和图像。



我一直在挖掘谷歌,堆栈溢出和API指令,找到任何相关的帖子。在谷歌地图的GET字符串中,我们可以看到这个块:

& msid = 212828439842926497866.0004bfae4da003d8ffd1f& mid = 1341413217



我认为可能有地图ID,我可以用它通过API查询地图的内容?我们的意图是将Google地图作为一个内容不太专业的CMS用户,而不是在我们自己的CMS中处理地理数据。



任何帮助都将不胜感激。也许我只是错过了树林。

解决方案

您可以下载kml,指定该页面中的标记并显示在您的基于API的地图上。 这个例子默认使用geoxml3显示它,但你可以隐藏它并显示KmlLayer版本。



您应该能够将KmlLayer指向链接(我下载了kml并将其放在我的服务器上,以便它可以与geoxml3一起使用)。 b
$ b

下面是一个示例(直接从文档中获取)



这是原始的


I am trying to embed an existing, public Google Map into a website. Specifically this one: http://goo.gl/maps/cHf2

Of course I could use the iframe embed to achieve this, but I would like a little more control over the map … I imagined being able to pull all the markers from the map and display them as an index next to the map. Kind of like Google already does, but embedded in my page with my own styles and images.

I have been digging through Google, Stack Overflow and the API instructions and couldn’t find any relevant posts. In the GET string of the map on Google we can see this chunk:

&msid=212828439842926497866.0004bfae4da003d8ffd1f&mid=1341413217

I thought in there might be a maps ID and I could use it to query the content of the map through the API? The intention is using Google Maps as a CMS for less technical minded people and not dealing with geo data in our own CMS.

Any help would be greatly appreciated. Maybe I am just missing the forest for the trees.

解决方案

You can download the kml that specifies the markers in that page and display that on your API based map. This example defaults to displaying it using geoxml3, but you can hide that and display the KmlLayer version.

You should be able to just point KmlLayer to the link (I downloaded the kml and put it on my server so it would work with geoxml3).

Here is an example (taken directly from the documentation) that does that

here is the original

这篇关于通过Google Maps API v3查询现有的公开Goog​​le Map的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆