Giter VIP home page Giter VIP logo

overpass-wizard's Introduction

overpass-wizard

Generates Overpass API queries from human friendly input. As seen in overpass turbo.

Build Status

command line utility

  $ npm install -g overpass-wizard
  $ # basic usage
  $ overpass-wizard "amenity=drinking_water"
  $ # example usage: grab data from Overpass API and display on geojson.io
  $ overpass-wizard "amenity=drinking_water in Rome" | query-overpass | geojsonio
  $ # list command line options
  $ overpass-wizard --help

API

Install via npm: npm install --save overpass-wizard. The module exposes a single function that takes the search string and an optional option object as arguments:

function(search, options)

  • search: the wizard search string to be concerted into an Overpass API query
  • options: optional options
    • outputFormat: output data format. either json (default) or xml
    • outputMode: specifies the output mode. either recursive, recursive_meta or any valid value of the Overpass out statement (default: geom)
    • timeout: query timeout in seconds (default: 25)
    • maxsize: memory limit in bytes
    • globalBbox: produces a global bounding box query (default: true)
    • compactNWR: produces a query with nwr statements if possible (instead of listing node, way and relation separately), resulting in more compact results (default: true)
    • aroundRadius: radius (in m) to be used with around <location> searches (default: 1000)
    • comment: boolean or string. if false, no comments will be added to the Overpass query output. if it is a string, it will be used in the header to explain what the query is doing
    • freeFormPresets: (experimental) path to a JSON file with presets in the schema used by the iD editor. Used to expand free form search input (e.g. Hotel in Vienna).

overpass-wizard's People

Contributors

matkoniecz avatar simon04 avatar tyrasd avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  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  avatar  avatar  avatar

overpass-wizard's Issues

Consider editing repository setings to remove "Packages" section

"Packages No packages published" is displayed right now, fortunately this pointless section can be removed.

Edit repo page config to remove it (cog next to the description).

I am not making a PR as it is defined in proprietary github settings, not in a git repository - and I have no rights to modify repo settings.

Peek 2020-10-25 09-10

Simplify playground:* key searches

Searching for keys with a common playground:* prefix seems a bit complicated: ~"^playground:.*"~"."

I wonder, if this could be simplified a bit to playground:*=*, or playground:*~*, or maybe even playground:*?

add support for "key is missing", for example by "!key" or "key not present"

At least for me searching for cases where some key or keys are nor present is a typical task. Currently it is impossible to generate such queries with wizard and in addition syntax for achieving that is quite cumbersome.


https://github.com/westnordost/StreetComplete is supporting first version in its internal equivalent of overpass-wizard

see for example https://github.com/westnordost/StreetComplete/blob/master/app/src/main/java/de/westnordost/streetcomplete/quests/recycling/AddRecyclingType.java#L21

where query is

nodes, ways, relations with amenity = recycling and !recycling_type"

!recycling type should be translated to

"recycling_type"!~".*"

Modernize: use nwr, nw, wr for shorter queries

Let’s take advantage of newer query statements to avoid overly excessive repetition of filter arguments we have today with node, way, relation. There’s shortcut for every combination of those three available.

standalone "newer" doesn't work

type:relation and newer:"2 minutes" global produces a query which results in a syntax error on Overpass API:

static error: "newer" can appear only inside "query" statements.

Here's the offending Overpass QL code (the error references line 8 which is the opening bracket of the query's main union statement):

/*
This has been generated by the overpass-turbo wizard.
The original search was:
“type:relation and newer:"2 minutes" global”
*/
[out:json][timeout:25];
// gather results
(
  // query part for: “newer:"2 minutes"”
  relation(newer:"{{date:2 minutes}}");
);
// print results
out body;
>;
out skel qt;

Modernize key!=*

Both wizard syntax and the generated ql code don’t support the more modern variant for „key!=*“ that is !key

In browser usage?

Hi! :)

We are thinking about integrating the wizard directly into uMap (see umap-project/Leaflet.Storage#118).
This lib seems the way to go, but, unless I'm missing something, it seems NodeJS only.

Would you mind also providing a browser ready packaged file?

Thanks in advance!

Yohan

Hosted overpass-wizard?

JOSM currently bundles the overpass-wizard and evaluates the JavaScript using JRE's ScriptEngine Nashorn which is very likely going to be removed in Java 15. The easiest replacement would be a webservice which accepts a string and returns the generated Overpass Query. Do you have / does overpass-turbo.eu have a running Node.js backend which could easily be extended to provide this service?

Thanks (and see you in Freiburg?)!

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.