添加Google“我的地图”图层转换为Google Maps JavaScript API [英] Add Google "My Maps" Layer to Google Maps Javascript API

查看:124
本文介绍了添加Google“我的地图”图层转换为Google Maps JavaScript API的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我知道自定义标记可以用Javascript添加到地图中,但我宁愿使用Google的MyMaps服务取而代之,因为我的同事可以在没有任何编程知识的情况下编辑地图。



您可以将自定义我的地图添加到嵌入的iframe 。我正在使用Javascript API,以便我可以利用API提供的控件(例如通过自定义控件缩放或更改地图上的位置而不触摸地图本身)。

我可以将创建并保存的地图作为图层插入到我的JS API地图中吗?

您可以使用 GGeoXml 将我的地图内容添加到您的API地图。



在您的我的地图中有一个在Google地球中查看链接,请使用该链接的网址作为您的GGeoXml网址。 >该链接会生成对数据的间接网络链接引用,因此您网页上的地图将反映对我的地图所做的最新更改。



缺点是您可以在我的地图的一页上放置多少标记,而Google地球中的视图链接仅返回当前我的地图页面的数据。


I want to put a Google Maps map on our website.

I know that custom markers can be added to a map with Javascript, but I'd rather use Google's MyMaps service instead, because then my co-workers could edit the map without any programming knowledge.

You can add a custom My Map to websites with an embedded iframe. I'm using the Javascript API instead though, so that I can take advantage of the controls the API delivers (such as zoom through custom controls or changing the position on the map without touching the map itself).

Can I insert the map created and saved with My Maps as a layer in my JS API map?

解决方案

You can use GGeoXml to add My Maps content to your API map.

In your My Map there's a "View in Google Earth" link, use the URL of that link as your GGeoXml URL.

The link generates an indirect "network link" reference to the data, so the map on your page will reflect the latest changes made to the My Map.

The downside is that there's a limit to how many markers you can place on one page of a My Map, and the "View in Google Earth" link only returns data for the current My Maps page.

这篇关于添加Google“我的地图”图层转换为Google Maps JavaScript API的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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