I have some geospatial data in .osm format (edited, conflated in josm) that I'd like to export that into GeoJSON. Are there any libraries or software that enable me to directly do this ? I've read that it's possible to export osm data via the API to JSON but some of my data isn't able to uploaded to OSM and thus, not looking for an API-based solution. (I've also found this tutorial where I'd have to first convert the data into a shp and then into geoJSON) but I'd prefer a more direct solution. asked 06 Dec '12, 16:44 skorasaurus |
osmtogeojson is yet another 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
But one can also use the library in javascript (browser or nodejs) projects. Take a look at the demo page. The converter is quite feature-complete. It supports multipolygons, has sophisticated polygon detection and can cope with incomplete OSM data. The code is already in use on geojson.io as well as overpass-turbo.eu (of which it is a spin-off, actually). The sources are found on github (MIT licensed).
permanent link
This answer is marked "community wiki".
answered 21 Oct '13, 10:54 tyr_asd |
One possible workaround that I've found is that I can open an .osm in qgis (using the OSM plugin, in the default qgis repository. Install by just searching for openstreetmap in the 'manage plugins'). and then saving it as a geojson. (Still looking for a direct, command line option). answered 07 Dec '12, 15:20 skorasaurus |
JOSM is able to export to GeoJSON, but it depends on what you need. There's no support for relations (that I know of). answered 11 Dec '12, 14:37 Sanderd17 |
I've found this javascript that converts OSM to geojson. Excellent. The newest version of ogr2ogr (v. 1.10) also supports conversion from osm to geospatial formats including geojson. answered 05 Mar '13, 21:31 skorasaurus osm2geo is actually a javascript script, not python. ;) Unfortunately, it only does a very basic data conversion (no multipolygons, tag agnostic polygons, etc.).
(21 Oct '13, 10:44)
tyr_asd
|