Skip to main content
100%

KML to GeoJSON

✓ Published0🌍 Public
Aakre54
Last edited Mar 29, 2014
Created on Mar 29, 2014

This example converts a GPS track from a KML file into a GeoJSON MultiLineString for use in web mapping. It reads `history.kml`, parses it with the `xml2js` library, extracts the coordinates from the `gx:Track` element, and writes the resulting GeoJSON to `points.json`. The conversion relies on Node.js’s `fs` module for file input/output and `parseFloat` to clean each coordinate pair. The output is a single-feature GeoJSON object with a MultiLineString geometry, ready for visualization with tools like D3’s `d3.geoPath`.

AI-generated description

Similar vizzes