npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

get-overpass

v0.3.0

Published

Get OpenStreetMap objects via the Overpass API as GeoJSON

Downloads

5

Readme

get-overpass npm version

Get OpenStreetMap objects via the Overpass API as GeoJSON

Quickstart

$ npm install -g get-overpass
$ get-overpass relation/3082668 > buenos-aires.geojson

CMD

$ get-overpass [-a/--api-endpoint url] [-m/--mapbox-ids] <OSM ID>

API

get-overpass exports a single function which returns a promise.

function getOverpass(osmId, mapboxIds = false, apiEndpoint = "https://overpass-api.de/api/interpreter") => new Promise()

Example:

const getOverpass = require('get-overpass')
getOverpass('relation/3082668')
  .then(data => console.log("Buenos Aires:", data)
  .catch(error => console.log("DOH!", error.message)

OSM IDs

There are two valid formats for OSM identifiers:

Examples of valid and equivalent OSM IDs are (osmtogeojson format, mapbox format):

  • relation/3082668, 30826684
  • way/213576258, 2135762581
  • node/4497495008, 44974950080

Only the primary OSM types relation, way, and node are supported, other types (ie area) are not supported.

Options

-a/--api-endpoint/apiEndpoint

Use the given url as an Overpass API endpoint. If not set, the default public Overpass API instance https://overpass-api.de/api/interpreter will be used. Note that general 'be friendly' data usage limits apply to the default endpoint.

-m/--mapbox-ids/mapboxIds

Format IDs in the output in Mapbox format. If not set, ID's will be in the default OSMtoGeoJSON format.

FAQ

How can I find the OSM ID of the feature I want to download?

One way to do this is to use the 'query features' tool (the question mark on the right of the interface) at https://www.openstreetmap.org/.

I get an error "Unable to covert geom to geojson?". What's up?

Under the hood, this tool uses osmtogeojson to build geojson from result sets. There are some OSM structures, particularly some relations, that it appears that osmtogeojson is unable to convert to geojson.

Do I need to worry about data licenses?

Maybe. OpenStreetMap data is licensed under the ODbL. Attribution is required, and derivative works must also be licensed under the ODbL.

Credits

Inspired by and makes heavy use of Per Liedman's query-overpass.