[Qgis-developer] intersect error

Martin Dobias wonder.sk at gmail.com
Thu Jan 22 10:49:01 EST 2009

On Thu, Jan 22, 2009 at 4:02 PM, Carson Farmer <carson.farmer at gmail.com> wrote:
>> 1. implement support for geometry collections: probably a partial
>> implementation allowing to retrieve parts of geometry collection from
>> GEOS would suffice for the begin.
> If I did implement this (as a partial implementation) would you recommend
> simply returning the geometry  collection as a list of geometries, or
> retrieving parts of the collection based on some input parameter (i.e.
> retrieve polygons only). From an initial glance at the GOES api, this first
> implementation looks possible, but I'm not a strong c++ programmer, so I'll
> likely have to run it by others once I'm done...

The approach with returning a list of geometry parts looks like a more
flexible approach to me.

> I don't know if it would be helpful or not, but Qt has a QValueVector class
> that could be implemented as a QgsGeometryCollection to represent the geos
> geometry collection.

Looking in Qt docs, QValueVector is only legacy Qt3 class - use
QVector<T> instead, e.g.:
QVector<QgsGeometry> parts();

(or maybe QVector<QgsGeometry*> )

>> 3. for problematic cases use this trick (G1 and G2 are geometries for
>> intersection):
>>  - Gx = G1.combine(G2)
>>  - Gy = G1.symDifference(G2)
>>  - G = Gx.difference(Gy)
>> Now G should contain the intersection, without the border. It works
>> with your test case, I think it should work in other cases too. This
>> option takes least effort (no C++ coding) but is also least effective,
>> so it's your choice :)
> If I can't get option 1. going, I'll have to go this route I think...

Good luck then!


More information about the Qgis-developer mailing list