Does anyone know how to get at the extendedData section of a Placemark or
other entry in KML files?  It doesn't look like getAttributes(),
getUserData() and getProperties(). Example KML and parser code below.


*example KML file:*
<?xml version="1.0" encoding="utf-8"?>
<kml xmlns="http://earth.google.com/kml/2.1";>
    <Document>
      <name>Switzerland 1837</name>
      <description></description>
      <Style>
        <ListStyle id="hideChildren">
          <listItemType>checkHideChildren</listItemType>
        </ListStyle>
      </Style>
<Placemark>
 <name>Aung San TB</name>
<visibility>0</visibility>
<Snippet maxLines="0"></Snippet>
 <styleUrl>#adv</styleUrl>
<ExtendedData>
<Data name="level">
 <value>1</value>
</Data>
<Data name="num">
 <value>300</value>
</Data>
<Data name="UnitID">
 <value>MMH00752</value>
</Data>
<Data name="LvlID">
 <value>MMP013001004000000000</value>
</Data>
</ExtendedData>
 <Point>
<coordinates>96.10939999999999,16.9165,0</coordinates>
</Point>
 </Placemark>
</Document>
</kml>

*example parser code:*

                Parser parser = new Parser(new KMLConfiguration());
                SimpleFeature f = (SimpleFeature)
parser.parse(newFileInputStream(file));
                Collection placemarks = (Collection) f.getAttribute(
"Feature");
                for (Object mark : placemarks) {

                    SimpleFeature feature = (SimpleFeature)mark;
                    Set<Entry<Object, Object>> entrySet =
feature.getUserData().entrySet();
                    getLogger().info("props:{} \n attributes: {}",
feature.getProperties(), feature.getAttributes());
                    getLogger().info("{}: {}", feature.getAttribute("name"),
feature.getAttribute("description"));
                }


thanks,

adam brin


_________________________________________________________
Adam Brin
Director of Technology, Digital Antiquity
480.965.1278
------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
GeoTools-GT2-Users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to