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

Hello,
A school will have a number of buildings and they will be located close by. I tried with overpass the query which can select only one of these buildings and skip the rest. But not Proper working. Can you tell me the query for that ....
https://overpass-turbo.eu/s/ZEM
[out:json] [timeout:25]; way({{bbox}})[amenity=school]; map_to_area ->.area; ( ( node "building"="school"; way "building"="school"; )->.scl; ( ( node ["building"="school"]"amenity"!~"."; way ["building"="school"]"amenity"!~"."; ); - ( // All nodes+ways with building=school and no amenity=* tag in area node ["building"="school"]"amenity"!~"."; way ["building"="school"]"amenity"!~".";
);)->.samp1; ( node.samp1(around.scl:100); way.samp1(around.scl:100); )->.near; (.samp1; - .near;); ); out center;

asked 03 Nov '20, 12:11

VIPINDAS%20K's gravatar image

VIPINDAS K
1257813
accept rate: 0%

To start with, the {bbox} you provided there is no amenity=school so your first two lines will return nothing. Which building are you attempting to single out?

(03 Nov '20, 12:49) DaveF

school building (outside the tag "amenity = school")

(03 Nov '20, 13:38) VIPINDAS K

I /think/ you may have over complicated things. It's unclear if you wan one or all those outside

Edit:

https://overpass-turbo.eu/s/ZH6

[bbox:{{bbox}}];
(
  nw[building=school];
  -
  (
    way[amenity=school];map_to_area;
    nw(area)[building=school];
  );
)->.Outside;  
foreach .Outside (
  way.Outside(around:100);
  way._(if:count(ways) == 1);
  out center;
);
permanent link

answered 03 Nov '20, 14:54

DaveF's gravatar image

DaveF
3.3k8498133
accept rate: 16%

edited 03 Nov '20, 17:10

This is exactly what is needed. But select only one school building and deselect the school building around it (within 100 meters). Is this possible?

(03 Nov '20, 15:07) VIPINDAS K

So you want all school buildings outside the perimeter of the school amenity, that are at least 100m away from other school buildings. Is that correct?

(03 Nov '20, 15:19) DaveF

Yes. (Select only one school building within 100 meter and skip the rest)

(03 Nov '20, 15:25) VIPINDAS K

I've updated the routine

(03 Nov '20, 17:11) DaveF

Thank you so much for your help .... Let there be 5 school buildings in one place (around 100 meters), select only one of them(and deselect the other school buildings). This is not possible in this query ... Can you include that too ....

(03 Nov '20, 19:16) VIPINDAS K

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:

×483
×228

question asked: 03 Nov '20, 12:11

question was seen: 1,332 times

last updated: 03 Nov '20, 19:16

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