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

Roger Bivand Roger.Bivand at nhh.no
Wed Feb 10 08:44:44 EST 2010


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.

>
>> As far as I can see, all the files there are C++, not C. I need C, not
>> C++, please. Just the #include, main(), and a place in the main to put the
>> data (say as WKT strings) and the function call, and a place to put the
>> output to screen. I did meet Bjarne Stroustrup in 1987, but that was
>> enough! Just setting up initGEOS(), etc., portably is hard.
>
> I completely understand your point of view.
> That's why I push hard for the C-API in the first place :)
>

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, 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). Maybe I can work out from the entrails 
of which output POLYGON objects built by Polygonizer belong to which input 
MULTIPOLYGON or POLYGON objects, and retain the ones needed for setdiff 
and intersect.

> Just, as a matter of fact, the actual workhorse is written
> in C++, so *if* a bug is found, the usual place to start
> for figuring out the culprint it is in object-oriented-land.
>
> In any case, the xmltester script takes XML files as input
> so you need no C++ nor C to prepare a testcase for your
> situation. Doing so would tell you if Difference and Intersection
> functions are broken at the low level.

Whether they are broken or not isn't my immediate problem; my problem is 
how to use them in accord with their design intentions. There are very 
many wrong trees to bark up here!

Roger

PS. Once I understand more, I'll try to write a C boilerplate that works.

>
> --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