怎样加载KML文件?

1 view
Skip to first unread message

阿木

unread,
May 16, 2008, 2:49:59 AM5/16/08
to Google 地图 API 讨论组
我做个一个学校的校园KML数据文件,想加载到google 地图中,具体的程序代码不了解,希望有高手给予指点,谢谢!

unco

unread,
May 17, 2008, 1:04:04 PM5/17/08
to Google 地图 API 讨论组
非常简单,相关代码如下
var map = new GMap2(document.getElementById("map_canvas"));
var geoXml = new GGeoXml("http://chinamapplets.googlepages.com/beijing-
cycles.kml");
map.addOverlay(geoXml);


Google手册中的例子http://code.google.com/intl/zh-CN/apis/maps/documentation/
services.html#XML_Overlays
http://code.google.com/intl/zh-CN/apis/maps/documentation/examples/geoxml-kml.html
详细内容看手册,http://code.google.com/intl/zh-CN/apis/maps/documentation/
reference.html#GGeoXml

unco

unread,
May 17, 2008, 1:06:53 PM5/17/08
to Google 地图 API 讨论组
忘了说,加载kml文件时,传入的一定要是一个公网可以访问的完整路径,实际上是google的api去读这个文件

On May 18, 1:04 am, unco <z12...@gmail.com> wrote:
> 非常简单,相关代码如下
> var map = new GMap2(document.getElementById("map_canvas"));
> var geoXml = new GGeoXml("http://chinamapplets.googlepages.com/beijing-
> cycles.kml");
> map.addOverlay(geoXml);
>
> Google手册中的例子http://code.google.com/intl/zh-CN/apis/maps/documentation/
> services.html#XML_Overlayshttp://code.google.com/intl/zh-CN/apis/maps/documentation/examples/ge...
> 详细内容看手册,http://code.google.com/intl/zh-CN/apis/maps/documentation/
> reference.html#GGeoXml
>
> On May 16, 2:49 pm, 阿木 <class1...@gmail.com> wrote:
>
>
>
> > 我做个一个学校的校园KML数据文件,想加载到google 地图中,具体的程序代码不了解,希望有高手给予指点,谢谢!- Hide quoted text -
>
> - Show quoted text -
Reply all
Reply to author
Forward
0 new messages