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 :) alt textalt text

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: alt text

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's gravatar image

accept rate: 0%

edited 09 Nov '17, 19:30

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.

permanent link

answered 10 Nov '17, 00:53

Frederik%20Ramm's gravatar image

Frederik Ramm ♦
accept rate: 23%


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 resultalt text

(13 Nov '17, 13:54) michal_poz
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



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:


question asked: 09 Nov '17, 19:20

question was seen: 1,177 times

last updated: 13 Nov '17, 13:58

powered by OSQA