[OSM-dev] osmtogeojson - yet another OSM-to-GeoJSON converter

Martin Raifer tyr.asd at gmail.com
Sat Oct 19 15:38:34 UTC 2013


I think this could be of use for someone: osmtogeojson, as the name  
suggests, is an OSM-to-GeoJSON converter. It's written as a javascript  
library, but can also be used as a command line tool: After installing it  
via `npm install -g osmtogeojson` you can use it like this:

   osmtogeojson in.osm > out.geojson

or even:

   echo '<osm><node lat="1.23" lon="3.21" id="-1" /></osm>' | osmtogeojson

But you can also use the library in your javascript (browser or nodejs)  
projects. Here is a simple demo page:


The converter is quite feature-complete already. It supports  
multipolygons, has sophisticated polygon detection[1] and can cope with  
incomplete OSM data.

The code is already in use on http://geojson.io as well as  
http://overpass-turbo.eu (of which it is a spin-off, actually). The  
sources are found on github (MIT licensed):


Best wishes,

[1] https://wiki.openstreetmap.org/wiki/Overpass_turbo/Polygon_Features

More information about the dev mailing list