如何从GGeoXml对象获取KML数据 [英] How to get the KML data from a GGeoXml object

查看:125
本文介绍了如何从GGeoXml对象获取KML数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用以下代码将KML文件加载到Google地图对象中:

  map = new GMap2(document.getElementById ( map_canvas 的)); 
geoXml = new GGeoXml(kml);
GEvent.addListener(geoXml,load,function(){
geoXml.gotoDefaultViewport(map);
//我想在这里阅读KML的内容
}) ;
map.addOverlay(geoXml);
// ...

我想要读取KML文件中的地标和将它们显示在列表中。我知道我需要的信息正在传输到浏览器,但我不知道如何访问它。 无法通过API访问它,但数据在GGeoXML对象内的混淆属性中可用。在Firebug中查看它,我发现这里的信息:
geoxml。$ q.ia。看看它自己,看看你需要的属性(名称,描述等)。


I load an KML file into a google map object using the following code:

map = new GMap2(document.getElementById("map_canvas")); 
geoXml = new GGeoXml(kml);
GEvent.addListener(geoXml, "load", function() {
    geoXml.gotoDefaultViewport(map);
    // I would like to read the KML contents here
});
map.addOverlay(geoXml);
// ...

I would like to read the placemarks from the KML file and display them in a list. I know that the information I need is being transferred to the browser but I don't know how to access it.

解决方案

You can't access it through the API, but the data is available in obfuscated properties inside GGeoXML object. Looking at it in Firebug, I found that information here: geoxml.$q.ia. Look at it yourself to see the properties you need (name, description, etc.).

这篇关于如何从GGeoXml对象获取KML数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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