GitXplorerGitXplorer
m

get-overpass

public
3 stars
0 forks
0 issues

Commits

List of commits on branch master.
Unverified
efb34d14cd372376c836aacdf54947e84824d09f

Release v0.3

mmfogel committed 7 years ago
Unverified
9885e0bb7d6c913406a308698bb99e19a8d59d13

Simplify getQuery()

mmfogel committed 7 years ago
Unverified
0ba0054834025f19e1e1a61b8b14a9008584b603

Add note about osmtogeojson failures

mmfogel committed 7 years ago
Unverified
ce740a5c5344757e7da39a798b1f335fbf6a899e

Test suite, fixes for it.

mmfogel committed 7 years ago
Unverified
d9549d8d3571f0d9f80a03f3da88899b467bb03c

Formatting & variable name changes

mmfogel committed 7 years ago
Unverified
b362e77d678ac1189dad335bb684757e72e38b89

Adopt auto-formatting from prettier-standard

mmfogel committed 7 years ago

README

The README file for this repository.

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.