[geos-devel] What do GEOSSymDifference and GEOSIntersection
(CAPI) do?
Roger Bivand
Roger.Bivand at nhh.no
Wed Feb 10 11:01:27 EST 2010
On Wed, 10 Feb 2010, strk wrote:
> 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)
Barfing for me with POLYGON and MULTIPOLYGON, returning the error
message: "Geometry must be a Point or LineString". I'll try to give a test
case.
>
>> 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
>
Yes, thanks. I'm using GEOSPointOnSurface to generate a point from the
POLYGON objects returned by GEOSPolygonize from the GEOSSymDifference
output to see which are in/out of the input objects to choose setdiff or
intersection. So far some progress, but light in the tunnel is usually an
approaching train. This avoids iterating on the output.
>> 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 *'.
Yes, thanks, got there. One gives GEOSRelatePattern a pattern like
"TFTFTFTF*" - I thought I could get a full analysis out at one shot,
returned in pat - another wrong tree. It is an input argument, not a
container for output.
Roger
>
> 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
>
--
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Helleveien 30, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: Roger.Bivand at nhh.no
More information about the geos-devel
mailing list