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

Hey there people,

I was curious if anyone can help me or guide me on how to create a map with the Postal Code Boundaries of Greece.

Roaming around the web, I found the initiative Free the post code where some creative people tried to create postal code boundaries from data, with an example here.

When I saw the Source code, I noticed that the authors approach and solve this problem with a Voronoi diagram, where as an input they give coordinates followed by postal code.

Can anyone help me to create the same input file for the Greece, from the Greek OSM data so I can test if the results are good enough?

The input should be latitude longitude post code but I am not sure how to extract them from the OSM file of Greece.

asked 30 Nov '20, 12:15

konsalex's gravatar image

konsalex
11112
accept rate: 0%


One way to approach it is to use osmium to filter the objects and translate them into a text oriented format:

osmium tags-filter -o codes.opl <Greece> 'addr:postcode'

You'd then want to process the ways in the file to have locations: https://docs.osmcode.org/osmium/latest/osmium-add-locations-to-ways.html

Then from there you would extract the information of interest from each line. I had recently done something similar to the first step, but have not done the other steps, but I think it's a reasonable approach. There's other tools that can do similar things.

permanent link

answered 30 Nov '20, 13:03

maxerickson's gravatar image

maxerickson
12.7k1083176
accept rate: 32%

Hey @maxerickson thanks for the reply.

I downloaded some data from overpass turbo with this query

` This has been generated by the overpass-turbo wizard. The original search was: “"addr:postcode"= in Greece” / [out:json][timeout:25]; // fetch area “Ελλάς” to search in {{geocodeArea:Ελλάς}}->.searchArea; // gather results ( // query part for: “"addr:postcode"=*” node"addr:postcode";

); // print results out body;

; `

Then I imported them to QGIS and performed a Voronoi clustering and then Dissolved with the Postal Code property.

Although the results are pretty nice and accurate, some areas seem to have not enough representative data to cluster them properly.

Any clue how to extract more data rather than using only nodes?

P.S.: As I can see Nominatim is computing the postal codes correctly so I am guessing behind the scenes they are not using only nodes.

(30 Nov '20, 15:10) konsalex

Thanks Max! I managed to do this as you said. The resulted ways although they include a postcode attribute it is empty when I load it to QGIS. Any clue why?

(01 Dec '20, 12:56) konsalex

Use nwr instead of node, and use out center for centroids (or you can just take polygons & compute centroids in QGIS & merge with node layer before doing the Voronoi.

(01 Dec '20, 13:19) SK53 ♦

Hey @sk53 . I executed the query with nwr instead of only nodes, but the are no ways displayed see here: https://prnt.sc/vtnmd7 (with addr:postcode I suppose).

(01 Dec '20, 14:42) konsalex
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:

×710
×100
×60
×55
×18

question asked: 30 Nov '20, 12:15

question was seen: 1,873 times

last updated: 01 Dec '20, 14:42

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