GeoXML3访问KML属性数据 [英] GeoXML3 accessing KML attribute datas

查看:121
本文介绍了GeoXML3访问KML属性数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的KML文件具有以下格式:

My KML File has the following format:

<Placemark>
<Style><LineStyle><color>ff0000ff</color></LineStyle><PolyStyle><fill>0</fill></PolyStyle></Style>
<ExtendedData><SchemaData schemaUrl="#seb">
    <SimpleData name="PR0">CORS</SimpleData>
    <SimpleData name="PR1">BRB</SimpleData>
    <SimpleData name="PR2">F15</SimpleData>
</SchemaData></ExtendedData>
  <MultiGeometry><Polygon><altitudeMode>clampToGround</altitudeMode><outerBoundaryIs><LinearRing><altitudeMode>clampToGround</altitudeMode><coordinates>71.0035714700001,38.4757616580001 71.0567352510001,38.398144523 71.1035044220001,38.422803406000138.4764993150001 71.0035714700001,38.4757616580001</coordinates></LinearRing></outerBoundaryIs></Polygon></MultiGeometry>

我希望能够从kml访问扩展的数据字段,我将使用它来进一步处理和索引多边形以供以后使用和搜索.

I want to be able to access the the extended data fields from the kml which I will be using for further processing and indexing the polygons for later use and searching.

正如这篇文章所述,可以从placemark.vars.val访问变量,但是由于vars是未定义的,所以我无法获得该变量.

As this post states, the variables can be access from placemark.vars.val but I could not get this since vars is undefined.

使用Geoxml3将kml扩展数据加载到变量中

推荐答案

在上面回复 geocodezip ...

您采用的方法是可行的,但问题是kml经常产生.进行您提到的更改可能会有些困难,因为<SimpleData>标记的内容包含期望的格式为<Data><value></value></Data>的文本值.

You approach works but the problem is the kml is produced frequently. Making the changes you mentioned might be a bit difficult because of the content of the <SimpleData> tag which contains the value as text where the expected format is <Data><value></value></Data>.

最好的方法是创建一个php或解析kml并进行更改的任何程序.我决定编辑GeoXML3.js解析器,以查找SimpleData而不是行号639的Data标记

Best way would be to create a php or any program that parse the kml and make the changes. I decided to edit the GeoXML3.js parser to look for SimpleData instead of Data tags at line number 639

var dataNodes = getElementsByTagName(extDataNodes[0], 'Data');

这篇关于GeoXML3访问KML属性数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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