[Qgis-developer] intersect error

Martin Dobias wonder.sk at gmail.com
Tue Jan 27 07:48:03 EST 2009


On Tue, Jan 27, 2009 at 3:16 AM, Carson Farmer <carson.farmer at gmail.com> wrote:
>
> Only thing I would change is that instead of returning an empty list if it
> is a single geometry, I would return a list containing the single geometry.

Okay, I've checked this change in SVN.

> This is essentially what the geos function does, and would make using this
> function much simpler:
>
> Essentially every time I do an intersection, I simply call
> asGeometryCollection(), and loop through the geometries, not worrying if
> there is one single geometry, or 5 parts of a geometry collection.

But I see some reasons why you shouldn't do it like this:
1. efficiency - for single-part geometries this would mean one more
copy of geometry (+ conversion from QList to python list)
2. compatibility - ordinary users of qgis v1.0 won't have
asGeometryCollection() available
3. destruction of geometries - I can't seem to find a way how to
convince SIP to transfer ownership of new geometries in the list to
python. So, while it works, there are leaked geometries after every
call :-(

Martin


More information about the Qgis-developer mailing list