简体   繁体   English

自定义用户创建的Google地图?

[英]Customizing a user-created google map?

I'm wondering if it is possible to insert a map (with some lines) that was created on google.com into a javascript that uses the v3 api. 我想知道是否可以将在google.com上创建的地图(带有一些线)插入到使用v3 API的JavaScript中。 I tried to read it up/google it, but I couldn't find anything so I'm guessing it isn't possible? 我试图将其阅读/谷歌搜索,但找不到任何内容,因此我猜这是不可能的吗?

If yes, - how? 如果是,-怎么样?

If you are talking about a map created in "My Places" on maps.google.com , those can be accessed as KML which can be displayed on a Google Maps API v3 map using KmlLayer 如果您谈论的是在maps.google.com上的“我的位置”中创建的地图,则可以将其作为KML访问,并可以使用KmlLayer在Google Maps API v3地图上显示

Map created in "My Places" 在“我的位置”中创建的地图

Same KML displayed on a Google Maps API v3 map with KmlLayer 使用KmlLayer在Google Maps API v3地图上显示的相同KML

To answer your additional question in the comments, the simplest way to do it is to take the example from the documentation and replace the URL with yours. 要在评论中回答您的其他问题,最简单的方法是从文档中获取示例,然后将URL替换为您的URL。 So yes, you can just change the filename URL in the first line of the initialize function to the URL of your KML: 因此,可以的,您只需将Initialize函数第一行中的文件名URL更改为KML的URL:

function initialize() {
  filename = 'http://gmaps-samples.googlecode.com/svn/trunk/ggeoxml/cta.kml'; 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM