javaapiforkml icon indicating copy to clipboard operation
javaapiforkml copied to clipboard

Handle incorrectly-specified LinearRing coordinates

Open orlade opened this issue 10 years ago • 3 comments

When a LinearRing's <coordinates> tag is malformed using additional commas instead of spaces (i.e. x,y,z,x,y,z,x,y,z,... instead of x,y,z x,y,z x,y,z ...), JAK simply returns a list with only the first point.

That behaviour is fair enough, but it would be nice if it could either parse the malformed data or throw an exception, since returning a single point is technically incorrect and makes it harder to catch data errors.

Google Earth and other apps parse that malformed data correctly, so perhaps it's not so uncommon? A subset of the file I'm working with is:

<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
  <Document>
    <name>malformed sample</name>
    <open>1</open>
    <description>20150015_182600_walkability</description>
    <Folder>
      <name>Convex hulls</name>
      <description>Convex hulls</description>
      <Placemark>
        <name>Convex hull</name>
        <description>14min</description>
        <Polygon>
          <tessellate>1</tessellate>
          <outerBoundaryIs>
            <LinearRing>
              <coordinates>
                144.92556815,-37.75302462,0,144.92250866,-37.75137202,0,144.91917398,-37.74918087,0,144.91607408,-37.74220241,0,144.92396822,-37.73528384,0,144.92542654,-37.73525344,0,144.93609834,-37.74142729,0,144.93865024,-37.74562287,0,144.93879371,-37.74586098,0,144.93115197,-37.75120675,0,144.93001997,-37.75173478,0,144.92556815,-37.75302462,0
              </coordinates>
            </LinearRing>
          </outerBoundaryIs>
        </Polygon>
      </Placemark>
    </Folder>
  </Document>
</kml>

orlade avatar Jan 26 '15 06:01 orlade

Interesting, if there's a way to express that in the XML schema, it should straightforward to convert it to code using the tools

ZiglioUK avatar Jan 26 '15 06:01 ZiglioUK

Sorry, this project is not actively maintained :pensive:

See #18 for further information.

mischah avatar Feb 21 '16 13:02 mischah

I'll look into this...

urbancamo avatar Nov 21 '23 18:11 urbancamo