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

2
1

Hello everyone,

I'm successfully extracting all buildings in a city with the following query

[out:json][timeout:500];area($AREA_ID)->.searchArea;(way["building"]["building"!="no"](area.searchArea););out body;>;out skel qt;

where $AREA_ID is the relation id of the city + 3600000000.

It works for many cities such as Paderborn, Düsseldorf, Frankfurt and Munich. However, it does not work for Cologne, Berlin and Hamburg. The problem is that the query exceeds the memory limit, the default being 2GB. I managed to increase it by using [maxsize: ... ] but it still says "Query run out of memory using about 4845 MB of RAM." and I can't increase the memory limit more on the public overpass servers (and I don't have a private server with more ram).

Is there a way to make this query consume less memory? Why does it even exceed these limits? If 2GB is enough for a city like Munich then almost 5GB should be enough for Cologne (Cologne is smaller than Munich). I've found old posts suggesting to use regular expressions to filter for attributes, but that doesn't seem to make anything better.

asked 03 Dec '16, 21:43

OSM%20noob's gravatar image

OSM noob
41113
accept rate: 0%


Please try the following query:

[out:json][timeout:500];
area($AREA_ID)->.searchArea;
way(area.searchArea);
way._["building"]["building"!="no"];
out; >; out skel qt;

This enforces the order of filtering. It is necessary in this case to first filter for all ways in Cologne, then filter for all buildings. If you count the number of buildings then you will recognize that Cologne has indeed almost double the number of buldings than Munich.

permanent link

answered 03 Dec '16, 22:06

Roland%20Olbricht's gravatar image

Roland Olbricht
6.7k36489
accept rate: 36%

2

works great, thanks

(04 Dec '16, 01:09) OSM noob

If you want to run this query for more that just a few cities, consider downloading a Germany (or Europe, or World) data file, importing it into a database with osm2pgsql (using a modified import style file that only processes buildings and possibly administrative areas if you need them), and then running SQL queries against that database.

permanent link

answered 03 Dec '16, 23:56

Frederik%20Ramm's gravatar image

Frederik Ramm ♦
82.5k927201273
accept rate: 23%

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
×147
×23
×15

question asked: 03 Dec '16, 21:43

question was seen: 4,221 times

last updated: 04 Dec '16, 01:09

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