NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum

0
1

I have the ID of the relation, and I need a API that returns its boundary box.

Example: the relation 298204, openstreetmap.org/relation/298204... Where its boundary box?

PS: I need BBOX in standard format (ex. to use in Overpass).

asked 30 Jul '18, 16:48

ppKrauss's gravatar image

ppKrauss
95192225
accept rate: 0%

edited 30 Jul '18, 18:34

1

If you know the relation ID, you can use this straight in Overpass. Are you trying to find all places within (in this case) São Paulo

(30 Jul '18, 17:16) andrewblack

Hi @andrewblack, thanks. Well, the question was oriented to BBOX but will be welcome an extra "how to use relation ID with overpass" (instead BBOX, as spatial mask to the query).

(30 Jul '18, 18:38) ppKrauss

Finding the bounding box

relation   (298204) ;
out  bb ;

gives the information you want (but not quite in the right format. A bit if editing will get it.

bounds minlat="-25.4832679" minlon="-53.1090000" maxlat="-19.7823272" maxlon="-44.1610000"

Using a relation within Overpass

Assuming you want to do the query mentioned in Best way to retrieve a CSV table from Overpass , the following query uses the area defined by the relation, rather than a bounding box.

[out:csv(::id,::user,::type,wikidata,name,place, boundary)] ;
relation   (298204) -> .c ;
.c map_to_area -> .myarea ;
( 
  node (area.myarea)  [place] [wikidata] ;
  relation  (area.myarea) [boundary] [wikidata];  
);
out meta ;

In a bit more detail

  • Load the relation into set c
  • Create an area from set c.
  • run the query - (area.myarea) restricts it to this area
permanent link

answered 30 Jul '18, 23:47

andrewblack's gravatar image

andrewblack
3651214
accept rate: 57%

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×236
×30

question asked: 30 Jul '18, 16:48

question was seen: 1,729 times

last updated: 30 Jul '18, 23:47

NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum