Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Namespaces are not considered when parsing kml #508

Open
Stadly opened this issue Feb 17, 2020 · 0 comments
Open

Namespaces are not considered when parsing kml #508

Stadly opened this issue Feb 17, 2020 · 0 comments

Comments

@Stadly
Copy link

Stadly commented Feb 17, 2020

It seems that namespaces are not taken into account when parsing kml files.

This file, with http://www.opengis.net/kml/2.2 as the default namespace, can correctly be converted to gpx format:

<kml xmlns="http://www.opengis.net/kml/2.2">
   <Document>
      <Placemark>
         <TimeSpan>
            <begin>2019-11-28T09:10:47.973Z</begin>
            <end>2019-11-28T09:18:30.731Z</end>
         </TimeSpan>
         <LineString>
            <coordinates>5.6503587,58.726241099999996,0 5.69573010002664,58.72640951793773,0</coordinates>
         </LineString>
      </Placemark>
   </Document>
</kml>

This file, which should be entirely equivalent, other than the namespace being called ns instead of being the default namespace, cannot be converted to gpx format:

<ns:kml xmlns:ns="http://www.opengis.net/kml/2.2">
   <ns:Document>
      <ns:Placemark>
         <ns:TimeSpan>
            <ns:begin>2019-11-28T09:10:47.973Z</ns:begin>
            <ns:end>2019-11-28T09:18:30.731Z</ns:end>
         </ns:TimeSpan>
         <ns:LineString>
            <ns:coordinates>5.6503587,58.726241099999996,0 5.69573010002664,58.72640951793773,0</ns:coordinates>
         </ns:LineString>
      </ns:Placemark>
   </ns:Document>
</ns:kml>

GPSBabel reports "Translation successful", but the converted file looks like this:

<gpx version="1.0" creator="GPSBabel - http://www.gpsbabel.org" xmlns="http://www.topografix.com/GPX/1/0">
  <time>2020-02-17T12:34:46.930Z</time>
</gpx>

This file, which is not valid kml, since it does not use namespaces, can correctly be converted to gpx format:

<kml>
   <Document>
      <Placemark>
         <TimeSpan>
            <begin>2019-11-28T09:10:47.973Z</begin>
            <end>2019-11-28T09:18:30.731Z</end>
         </TimeSpan>
         <LineString>
            <coordinates>5.6503587,58.726241099999996,0 5.69573010002664,58.72640951793773,0</coordinates>
         </LineString>
      </Placemark>
   </Document>
</kml>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants