/osm-geojson

🔰 Get GeoJSON of a OpenStreetMap's relation from the API.

Primary LanguageJavaScriptMIT LicenseMIT

osm-geojson

Travis CI Codecov npm npm version npm dependencies npm dev dependencies

🔰 Get GeoJSON of a OpenStreetMap's relation from the API.

Install

$ npm install --save osm-geojson

Usage

const osmGeoJson = require('osm-geojson');

osmGeoJson.get('365331'); // Italy
// => { type: 'GeometryCollection', geometries: [ { type: 'MultiPolygon', coordinates: [Array] } ] }

osmGeoJson.getAll({'ITA': '365331', 'USA': '148838'}); // Italy
// => {
// 'ITA': { type: 'GeometryCollection', geometries: [ { type: 'MultiPolygon', coordinates: [Array] } ] },
// 'USA': { type: 'GeometryCollection', geometries: [ { type: 'MultiPolygon', coordinates: [Array] } ] }
// }

API

get(osmid) ⇒ Promise.<object>

Returns the GeoJSON of a particular OSM relation id.

Returns: Promise.<object> - A promise that contains the GeoJSON of the given relation.

Param Type Description
osmid string Relation id from which extract the GeoJSON.

getAll(map) ⇒ Promise.<object>

Returns a map of GeoJSON of multiple OSM relation ids.

Returns: Promise.<object> - A promise that contains the map with the same keys of the map provided but with the GeoJSON of the given relation id as value.

Param Type Description
map object Map from a name to a relation id from which extract the GeoJSON.

Authors

See also the list of contributors who participated in this project.

License

This project is licensed under the MIT License - see the LICENSE file for details.