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

Is there a way to get an area around something (a road, a bus way, ...) ?

IE: "I want the area around 150m near a tram/bus/cycle way".

I got this query that return all bars around the tram "Ligne E" of Grenoble (city in France).

  way(area)[railway=tram]["oneway"="yes"]["name"="Ligne E"];
out body;
out skel qt;


If we analyse the problem with a simple 2D example :

alt text

  • I have a way (red) from A{2;2} to B{5;2}
  • I need the area (blue) CDEF ({1;3}, {6;3}, {6;1}, {1;1}).

I know how to get the way : in the query example, it's the way(area).... instruction. How to get the blue area with Overpass ?

With a concrete example, this is what I would like to have : from the blue line (a tramway), I want the purple area (around ZZ meter from this way).

alt text

asked 10 Feb '17, 09:51

mosmuk's gravatar image

accept rate: 0%

edited 21 Feb '17, 08:53

Maybe you get the area with the "around" operator ?

This OverPass query finds all nodes and ways within 50 meter of living streets in Rumst So you first "store" your first result in the set "streets" and then search nodes and ways around those streets.

You will notice that you do no get a nice rectangle as some large areas (closed ways) have one side that is within this 50m range and they are returned as whole.

This query does more or less what you want.

permanent link

answered 21 Feb '17, 11:24

escada's gravatar image

accept rate: 21%

This example returns all point of interest or way. What I really need is the coordinates of the shape around the ways (to use it with data from another database than OSM). I'm looking at whether there's a way to compute this outside the OSM queries.

(21 Feb '17, 14:12) mosmuk

AFAIK there is no way to find that box with OverPass. This is more suited for QGIS or PostGIS I think. OverPass is about finding OSM data, not finding boxes around data.

(21 Feb '17, 14:59) escada
permanent link

answered 20 Feb '17, 19:50

Hjart's gravatar image

accept rate: 18%

Thanks for the idea, but I want to know "how to get the polyline coordinate". I update my question with simple example.

(21 Feb '17, 08:42) mosmuk

Obviously, you are interested in something called - the corridor. The corridor and related apps are well known even from times long before the OSM's birth. Corridor geo-search, thick line rendering, safety monitoring, map-data preparation... are some of those applications.Very shortly:
A corridor area (L,D) is defined by its skeleton/leading line L and distance D (a half-width). Any of the corridor points has a minimum/shortest distance d<=D to its skeleton. All points at d=D distance create the border of the corridor. If a corridor contains its border it is called a closed corridor, else it is open (d< D). When the skeleton is a poly-line (a connected series of edge vectors) the corridor may be decomposed into two primitive area types: circular and rectangular. The circles all have the same radius D and centres in the poly-line nodes. The rectangles have the edge vectors as their middle line height and the 2D line basis. Because of the equivalences between a "point inside or outside a corridor" and a "point inside some and outside all primitives" we can create extraordinary fast and simple algorithms to check whether a point/geometry is inside or outside a given corridor. Namely, the primitives may be sorted to allow early elimination/filtering and the point-in-primitive mostly consists of comparisons. Here are some examples:
Along the coastline from A to B find all houses (of kind) closer than 500m to sea but not closer than 100m.
Create along the coastline of the country (including islands, eventually platforms and so on) a safety belt (corridor) of 25km width. Whenever a (fast) moving object enters/exits the belt issue an alarm and show the locations on map. Note that in this way you could do safety monitoring of thousands of (even very fast) moving objects on a solid laptop.
Detecting corridor replica objects in OSM. For example, there are tens of thousands of area borders where one is in the corridor (of certain width) of another. These are not exact replicas but just versions of the same object by high probability. In the preparation we keep the one with more details. For illustration see the data/borders of the Philcot Lake in Canada or the lakes here .

permanent link

answered 22 Feb '17, 22:36

sanser's gravatar image

accept rate: 5%

It's exactly what I'm looking for. But @escada seems to say that it's not available in overpass.

(23 Feb '17, 08:07) mosmuk

Overpass is used to retrieve OSM data, not data that can be deduced from OSM data. The corridor is not in OSM, so you cannot retrieve it with Overpass.

(23 Feb '17, 12:07) escada

Though, this not a discussion/argumentation place, the last comment needs some additional words. It is wrong and even (obviously)misleading. It is trivial to understand the difference between a data type and a logical shape used in application models. If an ANYpass tool-set (pretending to do spatial retrieval) does not have a corridor based retrieval model, it is just sad. But with such pretensions the ANYpass certainly contains a circle and rectangle based (the simplest) models. So, my point was that with the suggested corridor decomposition combined with the simplest spatial retrieval models anyone (even with no strong topology, polygon-algebra, programing) background could create the retrieval model (script) in the question.

(01 Mar '17, 08:46) sanser

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: 10 Feb '17, 09:51

question was seen: 6,406 times

last updated: 02 May '18, 13:26

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