Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

openstreetmap-geojson

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

openstreetmap-geojson

Get GeoJSON from OpenStreetMaps

  • 1.0.4
  • latest
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

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:

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

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

Keywords

FAQs

Package last updated on 26 Jun 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc