mapbox / togeojson

convert KML and GPX to GeoJSON, without the fuss

Home Page:http://mapbox.github.io/togeojson/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Inconsistent result between the website and nodejs

geommr opened this issue · comments

Not sure if this is the same as #130 but a "type" property doesn't get parsed in node, whereas it shows fine in the web version.
Ex:

<metadata>
  <time>2018-07-07T18:40:02Z</time>
</metadata>
<trk>
  <name>Test</name>
  <type>9</type>
  <trkseg>
   <trkpt lat="51.5035980" lon="7.4111550">
  </trkseg>
..

"name" and "time" show up in web/node but "type" only does in the web version.
Parsing gpx is done like so:
const geoj = togeojson.gpx(new DOMParser().parseFromString(fs.readFileSync("./uploads/" + file.filename, "utf-8")));

turns out "type" is only added here but somehow not added to the npm package.