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

I'm facing runtime errors for big countries and if it succeeds the browser crashes. I'm actually using this qeury in a python script

     (._;>;);out body;

Is there anything I'm doing wrong ? or is there any better query for what I want ?

asked 23 Jun '21, 09:00

Jad's gravatar image

accept rate: 0%

edited 23 Jun '21, 16:58

TZorn's gravatar image


Have a look at On the left-hand side in the country structure you can right-click and select all children (or only those you need). After clicking the download button you'll be asked which data format you require.

permanent link

answered 23 Jun '21, 11:19

mtmail's gravatar image

accept rate: 27%


Boundaries are huge, thus I think mtmail's answer is probably the best way.

But if you really need to go through overpass, first you should simplify your request. You don't need to ask for the ways, as they will be children of the relation. That should lighten the burden of the server if you don't ask the same objects twice.

Then, the search area is not precise enough, in your example (targeting Italy) I got the whole boundary of France and some of its regions. Maybe "is_in" might be better.

Also, do you really need every kind of boundaries there is ? National parks, municipality, voting zones, and so on. Maybe you could filter with admin_level. Trouble is that it's not totally consistent across every country, but I think it's thoroughly documented in the wiki (boundary, admin_level and subpages).

Good luck.


permanent link

answered 24 Jun '21, 11:05

H_mlet's gravatar image

accept rate: 13%

First, a general point: Could contributors, other than the OP, not alter the original question. It can make any replies appear to be nonsense & confuse those trying to learn. A part of Jad's problem was the syntax of the code. To correct it, an Answer should have been provided.

There are two answers to this Q

1) As as @mtmail suggests use the boundary site, where they have already been saved & segregated off the main server.

2) Going on JAD's original code as posted, the routine wouldn't have run, & even when corrected would probably have timed out for the whole of Italy.

This adapted routine is restricted to the visible area & to boundaries of only one admin level:

out geom;

There is no need to search for boundary ways as all should be mapped as rels.

permanent link

answered 24 Jun '21, 13:34

DaveF's gravatar image

accept rate: 16%

Dave. I merely formatted the query as code (with the grey background) as it was displayed as a single long line before. I didn't alter it in any way. And I shortened the title which ran over several lines and put the question in the text instead. Both served to make the question better readable but I didn't change anything in the content.

(24 Jun '21, 14:44) TZorn

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "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:


question asked: 23 Jun '21, 09:00

question was seen: 2,309 times

last updated: 24 Jun '21, 14:44

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