This is a static archive of our old OpenStreetMap Help Site. Please post any new questions and answers at community.osm.org.

Output Center and BBOX in a CSV output

0

I am using something as the code below, but need something as ::center of the relations (the ::lat and ::lon are only for nodes) and ::bbox.... What the syntax this kind of output?

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

asked 02 Sep '18, 15:40

ppKrauss's gravatar image

ppKrauss
95192225
accept rate: 0%


One Answer:

0

Just use out center to get the ::lat and ::lon for the relation centers.

[out:csv(::id,::type,::lat,::lon,wikidata,place, boundary)] ;
area(3600298285)-> .myarea ;
( 
  node (area.myarea)  [place] [wikidata] ;
  relation  (area.myarea) [boundary] [wikidata];  
);
out center meta;

I don't know if there is a way to get a bbox in csv output.

(There's info in the docs about directly looking up areas based on the OSM id they are generated from)

answered 02 Sep '18, 16:10

maxerickson's gravatar image

maxerickson
12.7k1083176
accept rate: 32%

Thanks, 50% of the answer (!)... If there are no manner to obtain BBOX, the answer will be 100%, so accepted. Lets wait some comment about existence of BBOX solution.

(02 Sep '18, 16:46) ppKrauss

You could do a separate query to get the bounds. http://overpass-turbo.eu/s/Bzz

(of course for nodes it doesn't return anything)

But I don't think there is any way to access the bounds using csv fields.

(02 Sep '18, 17:46) maxerickson

Thanks, yes, I must to change my goal, from CSV to JSON, that is the solution for any output...

(03 Sep '18, 01:59) ppKrauss

Source code available on GitHub .