I have some Scala code for parsing a KML 2.2 file using
org.geotools.xsd:gt-xsd-kml:16.1, but instead of getting my attributes in
userData, I'm getting an empty linked HashMap for the key
UntypedExtendedData.

I'm importing the v22 classes with:

import org.geotools.kml.v22.{KML, KMLConfiguration}

Here's the basic code for parsing:

val parser = new PullParser(new KMLConfiguration(), inputStream,
KML.Placemark)
val placemarks = parser.parse()

If I inspect the configuration, I see the namespace XSD is
http://www.opengis.net/kml/2.2, but the placemarks I get back show
http://earth.google.com/kml/2.1:placemark in the featureType.

Here's a truncated sample of the KML file I'm working with:

<?xml version="1.0" encoding="utf-8" ?>
<kml xmlns="http://www.opengis.net/kml/2.2";>
<Document><Folder><name>OGRGeoJSON</name>
  <Placemark>
        
        <ExtendedData><SchemaData schemaUrl="#OGRGeoJSON">
                <SimpleData name="OBJECTID">1</SimpleData>
                <SimpleData name="Proponent">USN</SimpleData>
                <SimpleData name="Branch">USN</SimpleData>
                <SimpleData name="Base">PMRF</SimpleData>
                <SimpleData name="Shape__Area">0.000738210065979</SimpleData>
                <SimpleData name="Shape__Length">0.241676762657087</SimpleData>
        </SchemaData></ExtendedData>
     
<Polygon><outerBoundaryIs><LinearRing><coordinates>-159.750238699210001,21.9809309990396
...</coordinates></LinearRing></outerBoundaryIs></Polygon>
  </Placemark>
</Folder></Document>
</kml>

The geometry seems to parse fine, but I need to get the attribute data
above, such as "Proponent" and "Branch."

Can someone shed some light on what I might be doing wrong? Thanks for your
time!



--
View this message in context: 
http://osgeo-org.1560.x6.nabble.com/KML-2-2-Not-Parsing-ExtendedData-tp5307519.html
Sent from the geotools-gt2-users mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
GeoTools-GT2-Users mailing list
GeoTools-GT2-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to