Hi everyone, sice a while i've been working on my own osm tiles server. I've made a huge progress since this -> https://help.openstreetmap.org/questions/58781/building-tiles-server Here are some pics showing the progress :) Currenty i'm faceing another problem, this time with rendering multipolygons, to be more precise I have a problem with getting nodes (points cordinates to be connected on the drawing) in the right order. Here is the pic showing the problem: Thats the riverbank build of ways. It seems i have all the nodes needed but they are (propobly) in the wrong order. Currently i'm grouping all the nodes by they orderId in the "way tag" and after that by the relationId of the "relation" so at the end I'm getting a list off all nodes in the relation (multipolygon) with x,y coordinates that are going to be connected on the drawing. Aslo, I've noteced that if I draw each riverbanks way separatly the riverbanks shape looks correct, but it's not a polygon (programicaly), just a bunch of a separated lines, so I can't fill it with a color. What am I missing? Already spend 4 days trying to figure it out, thank you for any comments :) asked 09 Nov '17, 19:20 michal_poz |
Multipolygon relations are not guaranteed to be ordered. You have to write an algorithm that figures out which parts need to be connected in which sequence (and which are outer or inner rings). Writing such an algorithm is hard. There is a general description on the Wiki and a good implementation in C++ in the Osmium library. Another approach is the "Polygonizer" class in the C/C++ library GEOS (bindings exist for many languages), which takes a bunch of lines and constructs a proper polygon from them. answered 10 Nov '17, 00:53 Frederik Ramm ♦ 2
The above answer is correct, relation ways were not sorted in the right order. After implementing this algorithm and some custom changes, everything seems to work correctly. Thank you for your help. And that is the current result
(13 Nov '17, 13:54)
michal_poz
|