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

Hi All,

I'm looking for a way to get the names of buildings in an overpasss query as result. As you can see in the picture below, the line 480228940 has the name "Ehemaliges Hallenbad Wallau". So I'm looking for a way to get all the coordinates of e.g. "Hallenbad" buildings in a specific bounding box.

Unfortunately I don't have any clue how I to set up the query and any suggestions are welcome!

BR, Tom

alt text

asked 14 Mar '19, 10:50

GIS_Wanderer's gravatar image

GIS_Wanderer
11112
accept rate: 0%


All OSM Buildings are supposed to be tagged with building=*, so searching for that should work. Unfortunately, it seems that there's not a lot of buildings with names in that area :(

Here's the query: (Try it)

[timeout: 240]
[out: json]
// choose a bbox:
[bbox: {{bbox}}] // search within the bbox of the map to the right (in-browser only)
// [bbox: south, west, north, east] // your custom bbox
;

// all nodes, ways or relations with a 'building=*' tag and a 'name=*' tag
// (remove the " [name]" to find all buildings)
(
  node [building] [name];
  way  [building] [name];
  rel  [building] [name];
);


// choose an output option:
out geom; // output coordinate data needed for display + tags.
//out tags; // output only the tags

The names, and all other tags, are included in the data returned by the query.

permanent link

answered 14 Mar '19, 13:48

owoce's gravatar image

owoce
61116
accept rate: 0%

1

you can get the centers by replacing out geom; with out center;. take a look here for a list of all the out options.

(14 Mar '19, 17:20) owoce

@owoce Sorry, your comment ended up here. I tried to convert @GIS_Wanderer's answer to a comment but OSQA (the software running OSM help) screwed up because there is a bug which prevents to convert answers that have been edited. I can't move your comment back because then another error occurs :(

(15 Mar '19, 08:58) scai ♦

Hi owoce,

thanks for your fast feedback! I checked out your code and indeed the map stays empty. Even when I try the complete name

way  [building] [name='Ehemaliges Hallenbad Wallau'];

the map stays empty. Is there a way to use place holders instead? E.g. hallenbad or even only bad.

I tried some other queries and for now the ouput are highlighted lines of the building shown in the map. Is there a way to get only one GPS location (lat / lon) per result?

BR, Tom

permanent link

answered 14 Mar '19, 15:19

GIS_Wanderer's gravatar image

GIS_Wanderer
11112
accept rate: 0%

edited 14 Mar '19, 15:20

3

The example in your screenshot is tagged as a construction area, not a building, so it won't show up in a query for buildings. If that's an example of the objects you're trying to retrieve, then it might not be buildings that you need to search for. Can you maybe edit your question to add more context about your ultimate goal? For example, once you get your results, what will you be doing with them? That might help us suggest a better way to reach that goal.

(14 Mar '19, 15:39) alester

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:

×75
×54
×28

question asked: 14 Mar '19, 10:50

question was seen: 2,050 times

last updated: 15 Mar '19, 08:58

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