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

In a city-sized area, I'm looking for buildings that have more levels than 12. I know that those are tagged with building:levels (untagged buildings are not interesting in this case). I have been trying to get them from Overpass Turbo, but AFAIK there's no way to say "find value > 12", and matching way["building:levels"~"^[234][0-9]$"]; times out (and only matches 20-49 anyway).

Is this the right tool? If so, how should I do this? If not - should I perhaps get an OSM extract and process it as XML with some other tool?

asked 26 Feb '16, 10:18

Piskvor's gravatar image

Piskvor
1.3k91535
accept rate: 37%

@mmd: While fiddling with the OpT query, I have found a working solution - I had a typo in there :(

(26 Feb '16, 11:29) Piskvor
2

BTW: Here's a link to the respective feature request: https://github.com/drolbr/Overpass-API/issues/78

(26 Feb '16, 11:36) mmd

I have found a way to hack around this in Overpass Turbo. Apparently, it's not possible to directly compare numbers, but it's possible to use regex - match "100-499" or match "20-99" or match "13-19". It's still not foolproof (fortunately, this key is unitless), but works with buildings up to 499 floors:

[out:json][timeout:25];
// gather results
(
  // 100-499
  way["building:levels"~"^[1234][0-9]{2}$"]({{bbox}});
  // 20-99
  way["building:levels"~"^[23456789][0-9]$"]({{bbox}});
  // 13-19
  way["building:levels"~"^1[3-9]$"]({{bbox}});
);
// print results
out body;
>;
out skel qt;

(Yes, I'm aware that with regex, I now have two problems ;))

permanent link

answered 26 Feb '16, 11:33

Piskvor's gravatar image

Piskvor
1.3k91535
accept rate: 37%

edited 26 Feb '16, 12:14

Try

way (if:number(t["building:levels"])>10)  ({{bbox}}); (._;>;); out;

Based on Overpass API/Overpass API by Example: Buildings that are taller than they are wide

permanent link

answered 14 Jan '22, 08:37

Marc's gravatar image

Marc
11
accept rate: 0%

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:

×228
×66

question asked: 26 Feb '16, 10:18

question was seen: 4,189 times

last updated: 14 Jan '22, 08:37

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