Skip to Content.
Sympa Menu

overpass - Re: [overpass] Date ranges with Overpass API

Subject: Overpass API developpement

List archive

Re: [overpass] Date ranges with Overpass API


Chronological Thread 
  • From: Roland Olbricht <>
  • To:
  • Subject: Re: [overpass] Date ranges with Overpass API
  • Date: Wed, 11 Jan 2017 20:09:51 +0100

Hello,

Although late, I would like to provide the promised follow-up.

First of all, thank you to all who have given feedback. The evaluator _is_num_ is now renamed to _is_number_ to be in line with _number_ and _date_ and _is_date_.

A still open point is the syntax for tag evaulation.
I agree that pure brackets might confuse users. And that syntax does not exist in any way in JavaScript or similar languages. I'm wondering whether an approach with a single letter, like

t[name]
v[name]

or so would make to tag evaulator more intuitively. I would like to stick with the brackets, because people know that as syntax of dictionaries. And the tags of an element constitute a dictionary.

That there is close-call syntax with a different meaning in the XAPI legacy is admittedly a pity. But we should not throw out that syntax just for the sake of purity, not now and not next year. Giving people a migration path to the more versatile present and future syntax is more important.

But now the promised further examples:


The filter for date ranges is actually a full fledged less than, and variants for less-equal, greater-than and greater-equal exist as well:

Find fast roads:
http://overpass-turbo.eu/s/lcg

Look for roads with non-number values:
http://overpass-turbo.eu/s/lch

Or objects that have only a name tag:
http://overpass-turbo.eu/s/lci

Beside this, one can find all objects with similar (or related) properties:
http://overpass-turbo.eu/s/lcj

Enhanced version, this one also gets nodes with level:
http://overpass-turbo.eu/s/lck

Even more, we could get one level up:
http://overpass-turbo.eu/s/lcl

Beside filter, the make statement allows to create objects as desired.
The simplest case is to output where useful a marker:
http://overpass-turbo.eu/s/lcm

This also contains a generalisation of the count.
You could list all values of a tag that exist in a result in addition to counting:
http://overpass-turbo.eu/s/lcn

The full list of aggregators, like _set_ and _count_ used here, can be found in the specification (TODO).


This version also brings a possibility to rewrite tags lists of objects.
If you do want objects with lots of tags in the result but only need some tags
then you can use an approach like this:
http://overpass-turbo.eu/s/lco

This has already been possible with the special output mode [out:csv].
But now you can feed this into your toolchain regardless whether you need XML or JSON as well.

Or just combine names:
http://overpass-turbo.eu/s/lcp

In some cases, you only want to knock out one or two tags:
http://overpass-turbo.eu/s/lcq


Finally, this allows to generate is_in-tags on the fly:

node({{bbox}})[place=village];
foreach(
is_in->.a;
( convert node ::=::,is_in=a.set([name]); .result; )->.result;
);
.result out;

(note: currently no areas on the dev instance, hence no link)

Although it is not fast, it generalizes to other relationships:
http://overpass-turbo.eu/s/lcr

Cheers,

Roland



  • Re: [overpass] Date ranges with Overpass API, Roland Olbricht, 01/11/2017

Archive powered by MHonArc 2.6.18.

Top of Page