1

I am really new to the OSM query language and I want to know how to find the relation id from the area id.

Here is the query that I made:

is_in(45.5697, 3.1572);
foreach(area._["boundary"~"(administrative|national_park)"];out ;>;out;);

1 Answer 1

2

I found the solution:

[out:json ];
is_in(45.5697,3.1572)->.a;
(
   rel(pivot.a)[boundary=administrative][admin_level=8];
   rel(pivot.a)[boundary~"(protected_area|national_park)"];
);
out ;
1
  • 1
    Using rel(pivot) is probably the most convenient approach. According to the Wiki, area ids can also to be derived from an existing OSM way by adding 2400000000 to its OSM id or in case of a relation by adding 3600000000 respectively. That in turn means that an area id doesn't always have to reference a relation id. Also, note that some special extraction rules apply, i.e. there's not always an area available for each single way or relation.
    – mmd
    Commented Dec 25, 2015 at 14:45

Your Answer

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

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