Coder Social home page Coder Social logo

query-overpass's Introduction

query-overpass

Query the OpenStreetMap Overpass API. Yet another implementation, because it

  • is isomorphic (works in the browser)
  • is lightweight (doesn't contain any sophisticated parser)
  • uses p-retry to resend requests

Other alternatives for you to evaluate:

npm version ISC-licensed support me via GitHub Sponsors chat with me on Twitter

Installing

npm install @derhuerst/query-overpass

Usage

Pass in a string of Overpass QL. Returns a Promise that will resolve with an array of elements.

const queryOverpass = require('@derhuerst/query-overpass')

queryOverpass(`
	[out:json][timeout:25];
	node(3378340880);
	out body;
`)
.then(console.log)
.catch(console.error)
[ {
	type: 'node',
	id: 3378340880,
	lat: 52.5145076,
	lon: 13.35011,
	tags: {
		artist: 'Friedrich Drake',
		artwork_type: 'statue',
		colour: 'gold',
		height: '66.9',
		image: 'https://upload.wikimedia.org/wikipedia/commons/2/2a/Victoria_Goldelse_Siegessaeule_Berlin.jpg',
		min_height: '58.6',
		name: 'Viktoria',
		'name:de': 'Siegessäule',
		'name:ru': 'Колонна победы',
		'name:zh': '勝利女神柱',
		reg_name: 'Goldelse',
		tourism: 'artwork',
		wheelchair: 'no'
	}
} ]

Note: The Overpass API does not support extended Overpass Turbo queries, as they are an Overpass Turbo-specific feature.

To use make requests from a web site, enable CORS using the fetchMode option:

queryOverpass(query, {fetchMode: 'cors'})

To use @derhuerst/query-overpass with a custom Overpass API endpoint, use the endpoint option:

queryOverpass(query, {endpoint: 'https://overpass.example.org'})

Related

  • osm-build-query – Build a query for the OSM Overpass API that retrieves all elements within the bounding feature.
  • osm-flatten-relation – Resolve an OpenStreetMap relation recursively.

Contributing

If you have a question or have difficulties using query-overpass, please double-check your code and setup first. If you think you have found a bug or want to propose a feature, refer to the issues page.

query-overpass's People

Contributors

derhuerst avatar greenkeeper[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

query-overpass's Issues

support custom Overpass API endpoints

Is it possible to set the url of the overpass api that is being queried? I have a local OSM server and would like to send the requests to that to allow for more requests per minute to come through. Thank you

An in-range update of pinkie-promise is breaking the build 🚨

Version 2.0.2 of pinkie-promise was just published.

Branch Build failing 🚨
Dependency pinkie-promise
Current Version
</td>
Type dependency

This version is covered by your current version range and after updating it in your project the build failed.

pinkie-promise is a direct dependency of this project, and it is very likely causing it to break. If other packages depend on yours, this update is probably also breaking those in turn.

Status Details
  • continuous-integration/travis-ci/push The Travis CI build failed Details

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.