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

A simple query can find the streets inside the boundary of a suburb.

[out:csv("name";false)] [bbox:-33.9480172,151.1107534,-33.8594833,151.2207935]; area[name="Beaconsfield"]; way(area)[highway][name]; out;

Beaconsfield Lane, Collins Street, Connolly Lane, McConville Lane, O'Connor Lane, Queen Street, Reserve Street, Victoria Lane, Victoria Street

In areas (cities) with multiple suburbs, the boundaries are usually streets and these are not included in queries for finding streets in suburbs. Their presence may be only visible by looking at a map or making a query via a bounding box or by making a boundary query as below.

Such streets can thus be listed in queries such as: [out:json][timeout:25] [bbox:-33.9480172,151.1107534,-33.8594833,151.2207935]; rel[name=Beaconsfield]; (._;>;); out;

The streets are readily extracted from the complex output with a simple bash script. However, how can the above Overpass query be modifed/extended/replaced to just supply the streets on the boundary of the suburb without resorting to bash scripts? - Beaconsfield Street, Botany Road, Johnson Street, O'Riordan Street, Reserve Street, William Street

asked 28 Aug '20, 14:15

rorylila's gravatar image

rorylila
41446
accept rate: 0%

I think if you try the first part on areas with named paths it will probably return the path names too.

But then I've always recoiled in horror whenever I've tried to look at the Overpass documentation, so you probably shouldn't listen to me.

(28 Aug '20, 17:32) InsertUser

The first bit of code in your output repeats some names as some of the ways are split in several places. Assuming this is OK, then a bit of experimentation gives a modification of your second snippet to:

[out:csv("name";false)][timeout:25] [bbox:-33.9480172,151.1107534,-33.8594833,151.2207935]; rel[name=Beaconsfield]; (._;>;); way._; out;

I think this would also return the names of rivers or streams that are used as boundaries, so an additional filter may be required if you're planning on looking at other suburbs too. It also won't be useful if for some reason one of the boundary lines is actually an independent way that happens to share nodes with a road etc.

To get both the outer and inner ways in one go:

[out:csv("name";false)] [bbox:-33.9480172,151.1107534,-33.8594833,151.2207935]; area[name="Beaconsfield"]; way(area)[highway][name] -> .b; rel[name=Beaconsfield] -> .a; (.a >; .a ; .b; .b > ; )-> ._; way._; out;

Again, this has the same repetition where ways are split, so depending on your use case you may need to use a script to clean up the output anyway.

The above snippets were cobbled together from your question and the information here. There's probably a much more elegant way to do this that I'm unaware of.

permanent link

answered 29 Aug '20, 00:39

InsertUser's gravatar image

InsertUser
11.0k1369185
accept rate: 19%

edited 29 Aug '20, 00:40

Thanks for the help. a) I do want to use the query over many suburbs. I do this already to find streets within suburb boundaries but that omits boundary streets. b) The second suggestion introduces unwanted streets from inside the boundary. c) Rivers etc should be able to be avoided by somehow using `highway' attributes as part of the query. Unfortunately, I am 'unskilled' and to me, the documentation is still quite opaque.

(29 Aug '20, 08:40) rorylila

The following seems to produce reasonably 'clean' output but still needs a bash sort. I guess there is no way around that. The admin_level is introduced because there are at least two overlapping administrative boundaries in the area of concern with the same name (Sydney) but different admin_levels. Highway is introduced to hopefully ignore other types of boundaries - rivers have been suggested.That is yet to be tested.

Script:

[out:csv("name";"false")] [bbox:-33.9480172,151.1107534,-33.8594833,151.2207935]; rel[name=Beaconsfield] [boundary=administrative] [admin_level=10]; (.;>;); way.[highway][name]; out;

Beaconsfield Street William Street Johnson Street Botany Road Botany Road Botany Road Botany Road Botany Road O'Riordan Street Reserve Street

permanent link

answered 29 Aug '20, 09:48

rorylila's gravatar image

rorylila
41446
accept rate: 0%

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:

×92
×33
×3
×1

question asked: 28 Aug '20, 14:15

question was seen: 1,525 times

last updated: 29 Aug '20, 12:13

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