Boost logo

Geometry :

Subject: [ggl] intersection of two vectors of polygons
From: Barend Gehrels (barend)
Date: 2011-04-29 18:20:25

Let me just answer on my own mail:

> It is not only this. A multi_polygon must be seen as a single
> geometry. It is one geometry, with one attribute (or one set of
> attributes). All the individual polygons making up that geometry share
> the same attribute(s).
> If you're into (spatial) databases, see it as one row, with a
> geometry-column (the multi-polygon) and one or more other columns (the
> attributes).

While this is the case in general and in most Geometry libraries and
databases, in Boost.Geometry the multi-polygons *can* have an attribute
(e.g. ID) for each polygon it contains, and this is (more or less by
chance, or by the approach) the case in the code I created. This might
be useful sometimes, but it is not required by the OGC specs and not
used in databases.

In the code I created it is useless, the output multi-polygon contains
zero or more polygons of the input polygons, but all with ID zero
(because of the default constructor).

If you want to work it out further, you have to create another model of
a multi-polygon, having two ID's (owner_id and mineral_rights_id), and
assigning these ID's right before or after intersection (comparable to
the mentioned property merge).

Each derived multi-polygon must be registered as a multi-polygon (I
didn't comment on that, but a large piece of the sample code I created
(everything in namespace traits) is necessary for registration of the
polygon_with_id - it might be convenient to have a macro for this in the

Regards, Barend

-------------- next part --------------
An HTML attachment was scrubbed...

Geometry list run by mateusz at