[Qgis-developer] intersect error

Carson Farmer carson.farmer at gmail.com
Thu Jan 22 10:02:54 EST 2009

Thanks Martin,

These are all much more complicated than I wanted, but that's life I 
> 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...

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.

According to the Qt docs:

QValueVector<T> defines a template instance to create a vector of values 
that all have the class T. QValueVector does not store pointers to the 
members of the vector; it holds a copy of every member, which is why 
QValueVector is said to be value based.
> 2. implement relate() function using GEOS which would take a geometry
> and intersection matrix as parameters. In the intersection matrix you
> could specify that you're not interested in boundaries so you should
> get just polygons.
I don't really know enough about intersection matrices to be able to 
handle this one...
> 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...


More information about the Qgis-developer mailing list