<Placemark id="3">
        <description><![CDATA[ Foo HTML stuff ]]></description>

Here is my code:

   PullParser parser = new PullParser( new KMLConfiguration(), FileUtils.openInputStream(new File("foo.kml")), SimpleFeature.class);

    SimpleFeature simpleFeature (SimpleFeature)parser.parse();
    Object obj = simpleFeature.getAttribute("TimeStamp");
    //obj is null..does not parse TimeStamp?..
    Object objPoint = simpleFeature.getDefaultGeometry();
    //this works fine...objPoint is an instance of Point...

    Object objDescription = simpleFeature.getAttribute("description");
    //this works fine, objDescription is an instance of String with the   CDATA data there.             

for example

simpleFeature.getAttribute("description"), will return a String of the content of the description which in the above KML is CDATA stuff...


, however TimeStamp is null :( ..I would have expected a Timestamp or a list of Date(s)?

is there a way to get the TimeStamp from the above KML with geotools without custom parsing?

  • please add the code you are using to parse the file – Ian Turton Mar 19 '19 at 8:36
  • It's after the xml. – Jeryl Cook Mar 19 '19 at 14:30
  • is this a bug or not supported feature? @IanTurton – Jeryl Cook Mar 19 '19 at 14:50
  • 1
    looking at developers.google.com/kml/documentation/… seems to indicate that TimeStamp is a v2.2 extension – Ian Turton Mar 19 '19 at 15:04
  • 1
    are you using a KML 2.2 Configuration? Other than that I can't really help as I don't use KML very much – Ian Turton Mar 19 '19 at 15:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.