This is a static archive of our old OpenStreetMap Help Site. Please post any new questions and answers at community.osm.org.

Finding a way at or around a specific coordinate

1

Hello,

i've been experimenting with Overpass and Nominatim for about a day now, but i can't seem to find the query that would yield the results i require.

I am initially given a coordinate (lat+lon) and need to find the way at this point (later on i will need to find intersections, too). I also need the nodes that make up the way.

All the results i got from overpass were either none, in a bounding box that clearly has a way in it, or they were more than 20 MBs of data, which is clearly too much for the bounding box i used. One of the queries i used was this:

<query type="way">

<bbox-query e="13.384931" n="52.477775" s="52.476769" w="13.386497"/>

</query>

<print/>

Can anyone help me with this?

asked 25 Sep '14, 09:20

Leopard2A5's gravatar image

Leopard2A5
31113
accept rate: 0%

I think what you want is to query

type:way

which will return all ways in a bounding box. Note, it will not return nodes or relations, only ways.

I used the very helpful Query Wizard while you may be using the more demanding Overpass Query Language.

(25 Sep '14, 10:49) AlaskaDave

Hi Dave, thx for the reply. I tried the wizard with "type:way" and it returned quite fast, marking all ways on the bbox i was currently looking at. It built the following query:

<osm-script output="json" timeout="25"> <union> <query type="way"> <bbox-query {{bbox}}=""/> </query> </union> <print mode="body"/> <recurse type="down"/> <print mode="skeleton" order="quadtile"/> </osm-script>

however when i replace {{bbox}} with the bbox-spec i'm interested in, the result is empty, allthough the given coordinates contain part of a way: <bbox-query e="13.384931" n="52.477775" s="52.476769" w="13.386497"/>

(25 Sep '14, 11:58) Leopard2A5

2 Answers:

2

You mixed east and west, try this instead:

<bbox-query e="13.386497" n="52.477775" s="52.476769" w="13.384931"/>

Usually this should be checked by the API but it obviously isn't for some reason.

answered 25 Sep '14, 13:20

scai's gravatar image

scai ♦
33.3k21309459
accept rate: 23%

edited 25 Sep '14, 13:21

2

facepalm Thanks for noticing that, scai, switching east and west yields the expected results!

(25 Sep '14, 13:31) Leopard2A5

3

If you need a way around a specific coordinate, you should probably take a look at the Overpass API 'around' filter rather than a bbox query. Bbox is ok'ish, but honestly it doesn't fit your use case all that well.

See link for more details.

answered 26 Sep '14, 18:13

mmd's gravatar image

mmd
5.7k15388
accept rate: 37%

1

Yeah that's even better! thanks mmd!

(08 Oct '14, 10:36) Leopard2A5

Source code available on GitHub .