[Qgis-developer] new geom function: combine cascaded

Martin Dobias wonder.sk at gmail.com
Tue Apr 13 05:35:20 EDT 2010


Hi Carson

On Mon, Apr 12, 2010 at 12:07 AM, Carson Farmer <carson.farmer at gmail.com> wrote:
> Hello devs,
>
> I have recently added a new function to QgsGeometry which speeds
> things up when combining (unioning) multiple geometries. It uses the
> cascaded union function recently added to GEOS [1,2], and can provide
> over 10 times speed-ups in many cases (my own tests [3] have shown a
> 14 times speed-up with even a relatively small polygon layer). Since
> I'm not really a C++ developer, I haven't committed these changes yet.
> Attached is a diff with the necessary changes. If some of you would
> like to test and take a look at my code, it would be much appreciated.
> As of now things compile and run nicely, but it's possible I've missed
> something important.

>From a brief look I have two comments:
- I would prefer the combineCascaded to be a static function - it
makes more sense to pass all N geometries in the list, not N-1
geometries in the list and 1 geometry that triggers the operation.
- I believe the cascaded union has been added in geos 3.1, so we
should either make it conditional (and fall back to classical union
for geos 3.0) or rise the minimal geos version to 3.1.
- the typeId choice should be probably improved to check all input
geometries - if they're not of the same type, geometry collection will
be used

Anyway this looks like a good addition!

Cheers
Martin


More information about the Qgis-developer mailing list