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

Hey, is it possible to add a polygon (for example the shape of a city) in overpass turbo, so that the output only contains data from the city (inside of the polygon)? Can I drag and drop or open a shapefile in overpass turbo for that? Or is there a way to draw one? Thanks for your help!

asked 07 Jun '22, 11:00

milo22948392's gravatar image

milo22948392
11335
accept rate: 0%


Edit: You can't import data into overpass & it doesn't really understand true polygons, just closed ways, but you can use existing OSM data.

There's quite a few ways to achieve this depending on what data you have for the area to be searched:

{{geocodeArea:Greater London}};
rel(pivot)->.Bound; //change to way to render
way(r.Bound)->.Bound;
.Bound out geom;
nwr[amenity=police](area);
out center;

These three lines are only to display the search area's boundary & can be removed if desired:

rel(pivot)->.Bound; //change to way to render
way(r.Bound)->.Bound;
.Bound out geom;

The boundary's ID:

rel(175342); map_to_area;
nwr[amenity=police](area);
out center;

The IDs for relations start at 3600000000 so by adding the id value to it allows

area(3600175342);
nwr[amenity=police](area);
out center;

Note the different brackets used:

area[name='Greater London'];
nwr[amenity=police](area);
out center;
permanent link

answered 07 Jun '22, 14:32

DaveF's gravatar image

DaveF
3.3k8498133
accept rate: 16%

edited 07 Jun '22, 15:52

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
×92
×87

question asked: 07 Jun '22, 11:00

question was seen: 2,048 times

last updated: 07 Jun '22, 15:52

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