Hi,

Menelaos Karavelas wrote:
On 04/08/2014 05:14 μμ, Andrew Hundt wrote:

As usual, it is really too bad the documentation for boost is so terrible. I would probably like it a lot more if it had reasonable documentation. Just getting to the above point, figuring out things like how to even get the points out of a multi_polygon has taken me hours, and I have no idea why simplify just makes everything size zero.


If you just want to "see on the screen" the multipolygon you can always use boost::geometry::wkt.

Or svg_mapper http://www.boost.org/doc/libs/1_55_0/libs/geometry/doc/html/geometry/reference/io/svg/svg_mapper.html
 
MultiPolygon is a Range of Polygons (http://www.boost.org/doc/libs/1_55_0/libs/geometry/doc/html/geometry/reference/concepts/concept_multi_polygon.html).

To access Polygon's Rings you can use:
- bg::exterior_ring() - http://www.boost.org/doc/libs/1_55_0/libs/geometry/doc/html/geometry/reference/access/exterior_ring.html
- bg::interior_ring() - http://www.boost.org/doc/libs/1_55_0/libs/geometry/doc/html/geometry/reference/access/interior_rings.html
namespace bg = boost::geometry;

Ring is a Range of Points (http://www.boost.org/doc/libs/1_55_0/libs/geometry/doc/html/geometry/reference/concepts/concept_ring.html).

So e.g. to get the first Point of an exterior ring you can use (assuming that the Geometries aren't empty):

// generic version
*boost::begin( bg::exterior_ring( *boost::begin(multi_poly) ) )

// non-generic version working ONLY for bg::multi_polygon and bg::polygon
multi_poly[0].outer()[0]

Yes, I agree that the documentation could be improved. If you have some ideas and willing to help don't hesitate to propose improvements (fixes, examples, better descriptions, etc.), ask questions about them (e.g. where exactly they should be added) and/or create a pull request on GitHub (https://github.com/boostorg/geometry).

Regards,
Adam