Omnivore helps Mapbox.js& Leaflet eat more types of data. We love and support GeoJSON, but sometimes specific data is in other formats, like GPX from a running watch, KML from Google Earth, CSVs from your spreadsheets, or TopoJSON files with enhanced geometries.
Omnivore makes it all super-simple:
omnivore.gpx('run.gpx').addTo(map);
Check out examples with GPX, CSV, and KML data.
You can start using Omnivore quickly because it’s included in the Mapbox Plugins CDN— or download it from its GitHub project.
On a code level, Omnivore is what we’d call a ‘glue module’. The underlying code for parsing these formats has already been written & tested - csv2geojson for CSV, wellknown for WKT, toGeoJSON for GPX & KML, and TopoJSON itself for parsing itself. This is great, because it means the code has been tested & deployed already — toGeoJSON is behind the scenes on Mapbox.com’s drag & drop, and geojson.io, and several other tools. But it can be tricky to connect the dots between different APIs and Leaflet.
So Omnivore is an extremely simple project that connects the code of different modules into something more directly usable for web maps. This kind of part is possible because of the npm module system, which manages the dependencies, and browserify, which packages the library for browsers.