toGeoJSON turns KML & GPX into GeoJSON

GeoJSON
⬇ togeojson.js less than 10 kB minified

or clone & contribute on github

toGeoJSON is a simple way to use KML and GPX formats with modern web tools like Leaflet and MapBox. It's simple, written in plain, dependency-free JavaScript and designed to work across browsers and in node.js.

Use this page to test it out, or download it to integrate into your application.

KML

  • LineString, Polygon, MultiPolygon, MultiLineString, Point, MultiGeometry
  • ExtendedData, SimpleData, name, description

GPX

  • Tracks, Routes, and Waypoints
  • Standard metadata