[OpenLayers-Users] Extract Attributes from KML or GML Files

Christian Ledermann christian.ledermann at gmail.com
Thu Nov 8 23:06:35 PST 2012


I think you already answered this but just to be  sure

untyped data like:

<ExtendedData>
  <Data name="string">
    <displayName>...</displayName>    <!-- string -->
    <value>...</value>                <!-- string -->
  </Data>
</ExtendedData>

cannot be extracted, it must be typed data like:

<kml xmlns="http://www.opengis.net/kml/2.2">
<Document>
  <name>ExtendedData+SchemaData</name>
  <open>1</open>

  <!-- Declare the type "TrailHeadType" with 3 fields -->
  *<Schema name="TrailHeadType" id="TrailHeadTypeId">*
    <SimpleField type="string" name="TrailHeadName">
      <displayName><![CDATA[<b>Trail Head Name</b>]]></displayName>
    </SimpleField>
    <SimpleField type="double" name="TrailLength">
      <displayName><![CDATA[<i>Length in miles</i>]]></displayName>
    </SimpleField>
    <SimpleField type="int" name="ElevationGain">
      <displayName><![CDATA[<i>Change in altitude</i>]]></displayName>
    </SimpleField>
  *</Schema> *

<!-- This is analogous to adding three fields to a new element of type
TrailHead:

  <TrailHeadType>
    <TrailHeadName>...</TrailHeadName>
    <TrailLength>...</TrailLength>
    <ElevationGain>...</ElevationGain>
 </TrailHeadType>
-->

  <!-- Instantiate some Placemarks extended with TrailHeadType fields -->
  <Placemark>
    <name>Easy trail</name>
    <ExtendedData>
      *<SchemaData schemaUrl="#TrailHeadTypeId">  *
        <SimpleData name="TrailHeadName">Pi in the sky</SimpleData>
        <SimpleData name="TrailLength">3.14159</SimpleData>
        <SimpleData name="ElevationGain">10</SimpleData>
      *</SchemaData> *
    </ExtendedData>
    <Point>
      <coordinates>-122.000,37.002</coordinates>
    </Point>
  </Placemark>
  <Placemark>
    <name>Difficult trail</name>
    <ExtendedData>
      *<SchemaData schemaUrl="#TrailHeadTypeId">  *
        <SimpleData name="TrailHeadName">Mount Everest</SimpleData>
        <SimpleData name="TrailLength">347.45</SimpleData>
        <SimpleData name="ElevationGain">10000</SimpleData>
      *</SchemaData>*
    </ExtendedData>
    <Point>
      <coordinates>-121.998,37.0078</coordinates>
    </Point>
  </Placemark>
</Document>
</kml>



On Fri, Nov 9, 2012 at 5:39 AM, Phil Scadden <p.scadden at gns.cri.nz> wrote:

> I read and display the features ok either from a KML or GML file, but
> can not extract the attributes.
> >
> > I use
> >
> > extractattribues: true
>
> Hopefully that is actually extractAttributes:true (case matters)
> Not every KML has attributes that are extractable. If it has
> <Schema>...</Schema> tag in the document headers and <SchemaData> in the
> features, then, yes. However, if "attributes" are just table entries in
> description, the no.
>
> Notice: This email and any attachments are confidential. If received in
> error please destroy and immediately notify us. Do not copy or disclose the
> contents.
>
> _______________________________________________
> Users mailing list
> Users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/openlayers-users
>



-- 
Best Regards,

Christian Ledermann

Nairobi - Kenya
Mobile : +254 702978914

<*)))>{

If you save the living environment, the biodiversity that we have left,
you will also automatically save the physical environment, too. But If
you only save the physical environment, you will ultimately lose both.

1) Don’t drive species to extinction

2) Don’t destroy a habitat that species rely on.

3) Don’t change the climate in ways that will result in the above.

}<(((*>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/openlayers-users/attachments/20121109/3ae9ebb9/attachment.html>


More information about the Users mailing list