I'm producing an interpreter file using the command from another question. That file I then parse with php... Iterate relation, then in the order the ways are printed I read their ref, take the referenced way, then I iterate the nodes of the way and read each node in the order it was printed. The lon and lat of each node I then put into a string like that
and so forth This I then put into the coordinates tag of a kml file. Now it seems that the order of the coordinates isn't correct, because the created shape in google maps is not closed but zigzagged :( (not all of it though, most part is correct) Is this normal ? What should I do ? asked 16 Apr '13, 23:06 SeWo |
In general, you first must stich the ways one to another. One possible way to do so is to keep an associative array of all first and last node ids in each way and to construct a single consecutive path by traversing the nodes of the ways this way. It is in general not guaranteed that the ways are in order or have the right orientation, but it is quite safe to assume that a valid area passes each node only once. I'm sorry that this is somehow vague, but I'm not familiar with PHP. But as even JavaScript has associative arrays, I'm quite sure they exist in PHP. answered 17 Apr '13, 07:37 Roland Olbricht |