Skip to content
This repository has been archived by the owner. It is now read-only.

fixes old markup KML GeometryCollection objects #4

Merged
merged 2 commits into from Aug 7, 2014

Conversation

@ffflabs
Copy link

@ffflabs ffflabs commented Jul 22, 2014

I was looking for interesting KMLs to examine and I came across this page in which there's a California State Highway Traffic Count. I downloaded it and found out it contained several GeometryCollection elements.

<Placemark xmlns="http://earth.google.com/kml/2.0">
      <name>880 - 194000 to 198000</name>
      <GeometryCollection>
        <LineString>
          <coordinates>-122.267080,37.795520,0.000000 -122.278930,37.800180,0.000000 </coordinates>
        </LineString>
      </GeometryCollection>
      <styleUrl>#8</styleUrl>
    </Placemark>
    <Placemark xmlns="http://earth.google.com/kml/2.0">
      <name>880 - 134000 to 146000</name>
      <GeometryCollection>
        <LineString>
          <coordinates>-122.278930,37.800180,0.000000 -122.282040,37.801390,0.000000 -122.283660,37.802080,0.000000 -122.284780,37.802490,0.000000 -122.286390,37.802880,0.000000 -122.287560,37.803040,0.000000 -122.288650,37.803100,0.000000 -122.289700,37.803070,0.000000 -122.290340,37.803010,0.000000 -122.294690,37.802280,0.000000 -122.296150,37.802130,0.000000 -122.296860,37.802130,0.000000 -122.297810,37.802220,0.000000 -122.298480,37.802340,0.000000 -122.299220,37.802530,0.000000 -122.300250,37.802900,0.000000 -122.301360,37.803470,0.000000 -122.301990,37.803890,0.000000 -122.302480,37.804290,0.000000 -122.302980,37.804780,0.000000 -122.303590,37.805560,0.000000 -122.304000,37.806270,0.000000 -122.304370,37.807230,0.000000 -122.304500,37.807910,0.000000 </coordinates>
        </LineString>
      </GeometryCollection>
      <styleUrl>#7</styleUrl>
    </Placemark>
    <Placemark xmlns="http://earth.google.com/kml/2.0">
      <name>880 - 127000</name>
      <GeometryCollection>
        <LineString>
          <coordinates>-122.304500,37.807910,0.000000 -122.304530,37.809080,0.000000 -122.304370,37.809990,0.000000 -122.304020,37.810910,0.000000 -122.303590,37.811660,0.000000 -122.303020,37.812390,0.000000 -122.302310,37.813080,0.000000 -122.301620,37.813600,0.000000 -122.300150,37.814600,0.000000 -122.300150,37.814600,0.000000 -122.299800,37.814760,0.000000 -122.298160,37.815760,0.000000 -122.297340,37.816340,0.000000 -122.296670,37.816890,0.000000 </coordinates>
        </LineString>
      </GeometryCollection>
      <styleUrl>#6</styleUrl>
    </Placemark>

GeometryCollection entities were deprecated as early as 2006, but I guess there might still be datasets with that feature, so I added the GeometryCollection $kml_type, mocked the parser method using parseMultiGeometry method, and treated it as a Multigeometry from then on.

I added a test too. The expectable behavior is for gisconverter to read a GeometryCollection, but export it as a MultiGeometry.

@symm symm merged commit 6936dbb into symm:master Aug 7, 2014
2 checks passed
@ffflabs ffflabs deleted the kml_geometrycollection branch Aug 7, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
2 participants