Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/emilioriosvz/openstreetmap-geojson
🤩🗺 Get GeoJSON from OpenStreetMaps
https://github.com/emilioriosvz/openstreetmap-geojson
api geojson maps openstreetmap openstreetmap-data osm osm-data
Last synced: about 1 month ago
JSON representation
🤩🗺 Get GeoJSON from OpenStreetMaps
- Host: GitHub
- URL: https://github.com/emilioriosvz/openstreetmap-geojson
- Owner: emilioriosvz
- Created: 2018-12-31T15:51:44.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2022-06-24T21:23:25.000Z (over 2 years ago)
- Last Synced: 2024-03-15T01:40:40.729Z (9 months ago)
- Topics: api, geojson, maps, openstreetmap, openstreetmap-data, osm, osm-data
- Language: JavaScript
- Size: 130 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 6
-
Metadata Files:
- Readme: Readme.md
Awesome Lists containing this project
README
# openstreetmap-geojson
Get the geojsons from openstreetmaps## Install
```
npm install openstreetmap-geojson
```## How to use?
If you just need one geojson you can do that:```js
const osm = require('openstreetmap-geojson')// 347950 is the osm relation id for Barcelona
const geojson = await osm.getGeoJSON(347950)
.catch(console.error)
```If you are going to need more than one Geojson, consider using this function so as not to abuse the api
```js
const osm = require('openstreetmap-geojson')const ids = [340783, 342563, 3657693, 344522, 347950]
const geojsons = await Promise.all(ids.map(id => osm.getGeoJSONPolitely(id, 200)))
```## API
### `.getGeoJSON(osmId)`
Given a osm relation id returns a Promise that resolves with the GeoJSON.### `.getGeoJSONPolitely(osmId, milliseconds)`
Wait the indicated milliseconds and then Given a osm relation id returns a Promise that resolves with the GeoJSON.## Todo
* Tests