TransWikia.com

Exporting buildings and their types with Overpass

Geographic Information Systems Asked by Taras on January 18, 2021

I am trying to extract all buildings in one file within a certain city (Radebeul, Sachsen, Germany) from Overpass Turbo.

Example

My query looks as follows:

[out:json];

// fetch area “Radebeul” to search in
{{geocodeArea:Radebeul}}->.searchArea;

// gather results
(
  // query part for: “admin_level=*”
  node["admin_level"](area.searchArea);
  way["admin_level"](area.searchArea);
  relation["admin_level"](area.searchArea);
);
  // query part for: “building=*”
(
  way["building"](area.searchArea);
  relation["building"](area.searchArea);
);

// print results
out body;
>;
out skel qt;

The output:
Export_result

Everything looks okay, however, I can not understand why do my previously queried administrative districts disappear in the final output? I just want to visually check if buildings are within city borders.

Moreover, I was wondering what is the most acceptable file format for QGIS import? Is it GeoJSON? While I am not sure if Overpass Turbo will provide me with buildings types as well.


References:

2 Answers

You need an additional union statement, so that the final result contains the result from both subqueries. Otherwise, your second part of the query will overwrite the results of your first part of your query in memory, and you're losing the administrative boundaries in your result.

[out:json];

// fetch area “Radebeul” to search in
{{geocodeArea:Radebeul}}->.searchArea;


(                // added union here
  (
    
    nwr["admin_level"](area.searchArea);
    way["admin_level"](area.searchArea);
    relation["admin_level"](area.searchArea);
  );
    // query part for: “building=*”
  (
    way["building"](area.searchArea);
    relation["building"](area.searchArea);
  );
);                        // added union here
// print results
out body;
>;
out skel qt;

Try this query in overpass turbo! http://overpass-turbo.eu/s/FDb

For importing this data in QGIS, check out the "QuickOSM" Plugin!

Correct answer by mmd on January 18, 2021

You've tried quick OSM directly from QGIS? Is quite simple to build a query on your town or ROI(using layer extent).

As for your file format question you cand export from qgis as geopackage(note: once you queried a example that will be displayed in QGIS as a virtual layer and you must export it to your drive). I hope it helps. Cheers!

Answered by George Boldeanu on January 18, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP