Talk:Relation:multipolygon/Algorithm

From OpenStreetMap Wiki
Jump to navigation Jump to search

Implementation

Hi. Has anybody implemented this algorithm for creating polygons in postgis after import with osmosis --write-pgsql ? I am working on it to display OSM data in quantum GIS but its quite tricky (Mayeul 9 February 2011).

Not me, but I guess Stephan P. and the people from OpenStreetBrowser 2.0 have. They use PostGIS functions in a plpgsql script, ST_LineMerge for step RA-4 for example. If you would like to take a look yourself: GNU Affero General Public License (AGPLv3) Source. Also the Lonvia crew has done some cool relation geometry processing, through they map hiking trails which are no polygons from my beginner's point of view. GNU GENERAL PUBLIC LICENSE V.3 Source. Both have Osmosis schema and PostGIS (both not quantum GIS though).--Guverneu 23:36, 8 October 2011 (BST)

End, beginning node

Question about this: "If the current ring is not closed: Take current ring's end node and look for an unassigned way that starts or ends with this node" Why only end node? Don't you need to check begin node too?

Say you want to find an adjacent line for your base-line. If you cant find a matching node for your base line's end node you can search on the beginning, I guess. But then there is a hole in it. On the search pool of possible adjacent lines I guess both ends are interesting. But thats just my theoretical point of view. Good luck (to ?) --Guverneu 23:36, 8 October 2011 (BST)

Ring grouping

unused ring inside unused ring

RG-3 Find one unused ring that is not contained by any other ring. Mark it as being the outer ring of the current polygon. Shouldnt this step read like this?:

RG-3 Find one unused ring that is not contained by any other unused ring. Mark it as being the outer ring of the current polygon. Reason is, the second ring in the "holes in holes" situation mentioned in Note 1 (way C in pic below) is always contained by any other ring but not by any other unused ring. This is, when more than one outer polygon is created in ring grouping step as I assume it is. Also this "holes in holes" situation is adressed in Note 2 with the two interlocking rings, right? Servus--Guverneu 08:28, 9 October 2011 (BST)

I think you are right, this should be corrected. --Tordanik 12:11, 2 November 2012 (UTC)

Example

Multipolygon illustration 10.svg
i
A B C D E F G
j contains A
contains B t
contains C
contains D t
contains E
contains F t
contains G

So RG-3 is called for Polygon A,C,E and G. Can anyone confirm this? An Adjacency matrix for a directed graph, right?