gekmlib bug found

Avatar

clinthyde

5 months ago

tried to use gekmlib this week...it broke on the first/only file I need to read...with an error on this:

<Placemark> <name>With our own power we have developed"</name> <LookAt> <gx:TimeStamp> <when>2002-04-30</when> </gx:TimeStamp> <longitude>124.4527286093449</longitude> <latitude>40.05648357791643</latitude> <altitude>0</altitude> <range>181.719067934862</range> <tilt>0</tilt> <heading>-2.534002456057512</heading> <altitudeMode>relativeToGround</altitudeMode> </LookAt> <styleUrl>#msn_icon244194</styleUrl> <Point> <coordinates>124.4528333149109,40.05633631105841,0</coordinates> </Point> </Placemark>

(sorry about the lack of line-breaks, flapping forum s/w won't let me easily get the xml shown right)

the problem, of course, is the presence of gx:Timestamp inside LookAt. that manifests as a "no such method" error of "setWhen" on "LookAt".

the error is actually in the setup in KMLParser.java:

String [] LookAtProperties = { "longitude", "latitude", "altitude", "range", "tilt", "heading", "altitudeMode"};

does not include gx:Timestamp/when... the solution might be to change LookAt to add a dummy setWhen method. I was not inclined to try to do this, since I don't know the gekmlib code...I went back to the certain-to-work approach of using xerces directly to do the parse, and an xpath query to get all the Placemarks and then handle those myself.