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 asked 30 Nov '20, 12:15 konsalex |
One way to approach it is to use osmium to filter the objects and translate them into a text oriented format:
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. answered 30 Nov '20, 13:03 maxerickson 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
|