如何从GGeoXml对象获取KML数据(How to get the KML data from a GGeoXml object)
我使用以下代码将KML文件加载到Google地图对象中:
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); // ...我想从KML文件中读取地标并将它们显示在列表中。 我知道我需要的信息正在传输到浏览器,但我不知道如何访问它。
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.
最满意答案
您无法通过API访问它,但数据在GGeoXML对象内的混淆属性中可用。 在Firebug中查看它,我在这里找到了这些信息:geoxml。$ q.ia。 自己查看一下,看看你需要的属性(名称,描述等)。
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.).
更多推荐
发布评论