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

want to write a code that has the Countrycode and Postcode as an input and the ouput are the streets that are in the given postcode using some apis that use OSM.

My tactic is as follows:

I need to get the relation Id of the district. For Example 1991416 is the relation id for the third district in Vienna - Austria. It's provided by the nominatim api: http://nominatim.openstreetmap.org/details.php?place_id=158947085

Put the id in this api url: http://polygons.openstreetmap.fr/get_wkt.py?id=1991416&params=0

After downloading the polygon I can put the gathered polygon in this query on the overpass api

( way (poly: "polygone data") ["highway"~"^(primary|secondary|tertiary|residential)$"] ["name"];

); out geom;

And this gives me the streets of the searched district. My two problems with this solution are 1. that it takes quite a time, because asking three different APIs per request isn't that easy on ressources and 2. I don't know how to gather the relation Id from step one automatically. When I enter a Nominatim query like http://nominatim.openstreetmap.org/search?format=json&country=austria&postalcode=1030 I just get various point in the district, but not the relation id of the searched district in order to get the desired polygone.

So my questions are if someone can tell my how I can get the relation_Id in order to do the mentioned workflow or if there is another, maybe better way to work this issue out.

Thank you for your help!

Best Regards Daniel

asked 12 Dec '14, 17:15

Shachty's gravatar image

Shachty
0111
accept rate: 0%

edited 15 Dec '14, 11:47

SimonPoole's gravatar image

SimonPoole ♦
44.7k13326701

3
(12 Dec '14, 17:48) mmd

The question has been closed for the following reason "Duplicate Question" by mmd 12 Dec '14, 17:48

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
×111
×55

question asked: 12 Dec '14, 17:15

question was seen: 7,006 times

last updated: 15 Dec '14, 11:47

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