[Qgis-developer] GEOS functions

Andreas Neumann a.neumann at carto.net
Sat Jan 31 11:33:16 EST 2009


as far as I know this behavior was already with GEOS 2x. You have to 
deal with it. In case you get a geometry collection you can extract the 
part you are interested in. In case you are dealing with Polygons, 
extract the polygon part and skip/ignore the line and point part of the 
Geometry collection. Thats how I did it with some Postgis related work.

I don't know if this is intelligent, but it seemed to work in my case.

Andreas

Carson Farmer wrote:
> Hello devs,
>
> Recently, I have noticed problems with several of the geoprocessing 
> functions that use GEOS. It appears as though GEOS frequently returns 
> geometry collections when performing overlay functions such as 
> intersections.
>
> What ends up happening is that if two *polygons* intersect, and this 
> intersection includes a single point, or a single line (in addition to 
> say overlapping portions of the polygons), then the geometry returned 
> is a geometry collection with (possibly) a point, line, and polygon. 
> If this is the case, when attempting to write the resultant feature to 
> file, it is skipped because it does not match the geometry specified 
> in QgsVectorFileWriter().
>
> Martin and I have tried to look at some solutions, and he has 
> implemented asGeometryCollection() for QgsGeometry(). However, this 
> solution is currently not optimal, and appears to have some memory 
> leaks. Do any other devs know if GEOS has changed the way overlay 
> functions are implemented (I'm using GEOS-3.0.3), and how we can 
> overcome this problem?
>
> Cheers,
>
> Carson
>


-- 
--
Andreas Neumann
Böschacherstrasse 6
CH-8624 Grüt (Gossau ZH)
Switzerland
Phone: ++41-44-2736668
Email: a.neumann at carto.net

Web: http://www.carto.net/neumann/
SVG Examples: http://www.carto.net/papers/svg/samples/
SVG.Open: http://www.svgopen.org/



More information about the Qgis-developer mailing list