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

Hello,

I'm building a C++ desktop application feature where you can visualize 3D data and I'd like to import 3D buildings from some locations specified by the user into it.

I looked at this kind of request https://wiki.openstreetmap.org/wiki/API_v0.6#Retrieving_map_data_by_bounding_box:_GET_.2Fapi.2F0.6.2Fmap but I'd like to filter it so only buildings are left in the result. Is it possible ? Since I'd like to be dependence-free (except CURL), I want to download the data given an URL and parse the .osm file myself if you guys think this is doable.

Is there a better way to to achieve what I'm trying to do ?

Thanks

asked 19 Nov '20, 16:47

Timo1111's gravatar image

Timo1111
11112
accept rate: 0%


Your usage sounds to me like it would fall under the second paragraph of the When NOT to use the API section of that page.

I think the some of Overpass API instances have fewer restrictions. This would also allow you to request only the ways and relations that are either building or building:part and associated geometry.

permanent link

answered 19 Nov '20, 23:01

InsertUser's gravatar image

InsertUser
11.0k1369185
accept rate: 19%

Sorry I'm late to answer, didn't have a PC this week-end.

I agree Overpass API seems more fitted for my needs but from what I saw I can't request buildings information only using an URL. Every request described in the documentation is using Overpass QL or Overpass XML language. Is there a REST API or should I put the OQL script in the body of a GET request ?

(23 Nov '20, 08:34) Timo1111
2

I'm not a developer myself, but the Overpass Turbo "export" options allow you to produce a "compact form" like this:

[out:xml][timeout:25];(nwr["building"](40.764472136395,-73.979962170124,40.766089194963,-73.976062238216);nwr["building:part"](40.764472136395,-73.979962170124,40.766089194963,-73.976062238216););out;>;out skel qt;

Which it then converts to a URL that looks like this: https://overpass-api.de/api/interpreter?data=%5Bout%3Axml%5D%5Btimeout%3A25%5D%3B%28nwr%5B%22building%22%5D%2840%2E764472136395%2C%2D73%2E979962170124%2C40%2E766089194963%2C%2D73%2E976062238216%29%3Bnwr%5B%22building%3Apart%22%5D%2840%2E764472136395%2C%2D73%2E979962170124%2C40%2E766089194963%2C%2D73%2E976062238216%29%3B%29%3Bout%3B%3E%3Bout%20skel%20qt%3B%0A

Which I assume is the same but percent encoded?

(23 Nov '20, 23:49) InsertUser

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:

×290
×37

question asked: 19 Nov '20, 16:47

question was seen: 2,556 times

last updated: 23 Nov '20, 23:49

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