5

In https://wiki.openstreetmap.org/wiki/Overpass_API/Overpass_API_by_Example

there is an example as shown below in the code section. I would like to know what is

b
u 
and b.u?

Code:

[timeout:600];
rel[admin_level=2][wikidata]->.a;
foreach .a -> .b (
  rel.a(if:t[wikidata] == b.u(t[wikidata]))->.d;
  rel.d(if: id() == d.min(id()) && d.count(relations) > 1 );
  convert rel ::id = _.u(id()),
             wikidata = _.u(t[wikidata]),
             all_relation_ids = d.set( id() );
  (._ ; .result; ) -> .result;
);

.result out;

1 Answer 1

5

These are just arbitrary names for sets. Sets contain OSM elements such as nodes, ways and relations. If you don't specify an explicit set name then the default set named _ will be used.

From your example: Set a is populated by this line:

rel[admin_level=2][wikidata]->.a;

Then it will loop through set a and populate set b:

foreach .a -> .b (

Inside the loop, a set d gets created:

rel.a(if:t[wikidata] == b.u(t[wikidata]))->.d;
2
  • what is u then please
    – Amrmsmb
    Mar 8, 2021 at 9:39
  • 1
    u is an aggregator function for sets. In my opinion, Overpass QL has a rather poor naming scheme. At least for some operations.
    – scai
    Mar 8, 2021 at 9:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.