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

Hello!

I try to get all postcodes from a area like "Munich". I tried:

<area-query ref="3600062428" />
 <recurse type="node-relation" />
 <query type="relation">
   <item />
   <has-kv k="boundary" v="postal_code"/>
 </query>
<print />

but the result is just empty. Any ideas how to do it? What I need are just the postcodes itself.

asked 07 Feb '13, 13:39

wuschba's gravatar image

wuschba
41225
accept rate: 0%

edited 07 Feb '13, 13:40


Yes, please use "recurse type='up'" instead.

<area-query ref="3600062428" />
  <recurse **type="up"** />
  <query type="relation">
    <item />
    <has-kv k="boundary" v="postal_code" />
  </query>
<print />

Postal code boundaries are made of ways which in turn are made of nodes, so there is no direct connection between the nodes and the relations. For that reason, the recurse node-relation doesn't find anything. By contrast, recurse "up" searches also for these indirect memberships.

permanent link

answered 08 Feb '13, 07:42

Roland%20Olbricht's gravatar image

Roland Olbricht
6.7k36489
accept rate: 36%

edited 08 Feb '13, 07:44

Any idea why this won't work in Austria? Apetlon, 3600105619, should have the postcodes: 7132,7143,7161 but the result of the query

node(area:3600105619);
<;
relation._["boundary"="postal_code"];
out;

stays empty.

(21 Feb '13, 13:57) wuschba

Got a 2nd problem: The node for "Ingolstadt" gives me these postcodes: <tag k="postal_code" v="85049,85051,85053,85055,85057"/>

But doing your query on 3600062381, I get much more postcodes. What might be the problem?

(21 Feb '13, 14:08) wuschba
Your answer
toggle preview

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:

×483

question asked: 07 Feb '13, 13:39

question was seen: 3,116 times

last updated: 21 Feb '13, 14:08

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