Hi John,

On 20-2-2013 16:29, John Lilley wrote:

Greetings, I am looking for some guidance around the correct creation and use of multi-part polygons.  I am a bit confused about when to use each of the following:

·         Polygon with multiple rings

·         Vector of polygons

·         Polygon set

·         Set/vector of polygons, each potentially containing multiple rings

 

I gather from this example picture:

http://geometrylibrary.geodan.nl/03__polygon__example_8cpp-example.html


Note that this documentation is VERY old. The correct docs are here:
http://www.boost.org/doc/libs/1_53_0/libs/geometry/doc/html/index.html

Examples like above are not included in the doc's, but they still exist in the SVN tree.


 

That if one wants holes to be opened as a result of intersection, they need to be rings as opposed to polygon sets or vectors of polygons?



Hmm, no... If two polygons, or multipolygons, do have the normal winding order, any holes are generated automatically. With normal I mean, w.r.t. to the specified clockwise order. If you use boost::geometry polygons, they are by default ordered clockwise.

In "normal" (multi)polygons, exterior rings are ordered clockwise, interior rings are ordered counter clockwise. This is an often-used convention.

If your polygons are not like that, just use boost::geometry::correct

 

An example would be polygon(s) representing an island chain.  Some of the islands are atolls and as such have a hole in the middle.  What would a representation of this set of islands look like?


This is a multi polygon.

 

And, what If I don't know if I have "real" rings (interior) vs just a collection of polygons (like I got this from an external source that doesn’t have the same model).  If I just throw a pile of points at a polygon and call clean(), will that magic everything up for me?


Not clean().  Where did you get that from?

Currently there is not a function like that, but dissolve in the extensions would target this functionality. Correct works only for the direction of rings, not to remove interior overlaps.


Regards, Barend