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

Hi, for my application I need the ways around me (e.g. in a 2000m radius). At the moment I have the following query (Overpass):

<query type="way">
   <around lat="40.65541" lon="-4.70717" radius="2000"/>
</query>
<union>
  <item/>
  <recurse type="down"/>
</union>
<print/>

From this query, I get nodes and ways. Example of a way:

  <way id="305251304">
    <nd ref="634163717"/>
    <nd ref="3098509510"/>
    <nd ref="3660108566"/>
    <tag k="highway" v="residential"/>
    <tag k="name" v="Calle Valladolid"/>
    <tag k="source" v="ITACyL"/>
    <tag k="source:date" v="2009"/>
  </way>

My first problem is that I need more details (name, ref name, maxspeed...) for the ways. At the moment, I make another request to Nominatim for each way, e.g.:

https://nominatim.openstreetmap.org/lookup?format=json&namedetails=1&osm_ids=W305251304

This takes too long. Is it possible to get the details for all the ways already in the Overpass query? If not, is there another API which I can use for my requirements? By the way: I have installed Nominatim and Overpass on my own server because I send many requests.

My second problem is that I just need streets, I don't need e.g. cycleways, footways and buildings. How can I manage this in my query?

asked 06 Dec '17, 06:59

FM_Pete's gravatar image

FM_Pete
16235
accept rate: 0%

I solved the first problem by myself.

I have now the following query:

<query type="way">
   <around lat="40.65541" lon="-4.70717" radius="2000"/>
  <has-kv k="highway" modv="not" regv="path|track|cycleway|footway"/>
</query>
<union>
  <item/>
  <recurse type="down"/>
</union>
<print/>

How can I exclude e.g. areas for landuse? The following query doesn't work:

<query type="way">
   <around lat="40.65541" lon="-4.70717" radius="2000"/>
  <has-kv k="highway" modv="not" regv="path|track|cycleway|footway"/>
  <has-kv k="landuse" modv="not"/>
</query>
<union>
  <item/>
  <recurse type="down"/>
</union>
<print/>

(06 Dec '17, 07:32) FM_Pete

To just retrieve highways, add a rule for that. In the QL, way[highway][highway!~"path|track|cycleway|footway"];. The first rule includes all highways, the second rule excludes some of them.

As far as the details, Overpass API is returning all of the tags associated with a given way. Nominatim adds a calculated address, something Overpass API can't do.

permanent link

answered 06 Dec '17, 16:48

maxerickson's gravatar image

maxerickson
12.7k1083176
accept rate: 32%

edited 06 Dec '17, 16:49

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:

×689
×483
×147
×85

question asked: 06 Dec '17, 06:59

question was seen: 3,725 times

last updated: 06 Dec '17, 16:49

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