[geos-devel] What do GEOSSymDifference and GEOSIntersection (CAPI) do?

strk strk at keybit.net
Wed Feb 10 10:24:15 EST 2010


On Wed, Feb 10, 2010 at 02:44:44PM +0100, Roger Bivand wrote:
> On Wed, 10 Feb 2010, strk wrote:
> 
> >On Wed, Feb 10, 2010 at 12:35:46PM +0100, Roger Bivand wrote:
> >
> >>Are GEOSSymDifference() and GEOSIntersection() intended to take at least
> >>POLYGON inputs, and then return POLYGON output, or not?
> >
> >No. They are supposed to work also on linear and puntual geometries.
> 
> Clearer please, your "also" confuses me. Do they work on POLYGON or 
> MULTIPOLYGON at all? They do work on LINESTRING and LINEARRING, I've 
> tried.

Yes, if given POLYGONS or MULTIPOLYGONS they *may* return POLYGONS
or MULTIPOLYGONS or LINESTRINGS or MULTILINESTRINGS or POINTS or
MULTIPOINGS (depending on the way the POLYGONs you passed in relate
to each other)

> The ST_BuildArea code looks useful, although I'm afraid that my 
> PARANOIA_LEVEL is >> 1! Debugging C is simply so much easier under layers 
> of other software (for me).
> 
> I'm trying a work-around using GEOSSymDifference() for setdiff and 
> intersection operations,

That's exactly what BuildArea does in postgis (after Polygonize):
         * Iteratively invoke symdifference on outer rings
         * as suggested by Carl Anderson:
         * postgis-devel/2005-December/001805.html

> and would value advice on what "pat" in 
> GEOSRelatePattern(GCA, GCC2, pat); should be declared as (neither const 
> char pat[9] nor char pat[9] work).

Takes a 'const char *' and doesn't refuse a 'char *'.

Use the source, Luke:

 (GEOS C-API header):
http://trac.osgeo.org/geos/browser/trunk/capi/geos_c.h.in

 (Postgis [C code] use of GEOS C-API):
http://trac.osgeo.org/postgis/browser/trunk/postgis/lwgeom_geos.c

--strk;

  ()   Free GIS & Flash consultant/developer
  /\   http://foo.keybit.net/~strk/services.html


More information about the geos-devel mailing list