osmtogeojson converts OSM data to GeoJSON.

### OSM data

### GeoJSON

convert to GeoJSON →

osmtogeojson is a Javascript module for converting OSM data (OSM XML or Overpass JSON) to GeoJSON. It works in the browser, nodejs and can also be used as a command line tool. This OSM conversion code was written for and is maintained by the overpass-turbo project.

Usage:

- In the browser:
  - `<script src='osmtogeojson.js'></script>`
  - `osmtogeojson(osm_data);`
- As a nodejs library:
  - `$ npm install osmtogeojson`
  - `var osmtogeojson = require('osmtogeojson');
    osmtogeojson(xml_data);`
- As a command line tool:
  - `$ npm install -g osmtogeojson`
  - `$ osmtogeojson file.osm > file.geojson`

Read more about the API in the official documentation.

download osmtogeojson.js
github: tyrasd/osmtogeojson
npm: osmtogeojson
license: MIT