[geos-devel] GEOSIntersection returns the input
    Jürgen E. Fischer 
    jef at norbit.de
       
    Tue Aug 25 03:22:41 EDT 2009
    
    
  
Hi Giacomo,
some comments:
On Tue, 25. Aug 2009 at 09:03:47 +0200, Giacomo Piva wrote:
>    coordseq = (GEOSCoordSeq) GEOSCoordSeq_create(5, 2);   //5 points bi-dimensional
[...]
>    area_1 = GEOSGeom_createLinearRing(coordseq);   
[...]
>    area_2 = GEOSGeom_createLinearRing(coordseq);
You need a new coordinate sequence here.  GEOSGeom_createLinearRing takes
ownership of it.
>    intersection = GEOSIntersection(area_1, area_2);
You're intersecting two rings here.   You might want to GEOSGeom_createPolygon
from the rings and intersect those.
>    GEOSCoordSeq_destroy(coordseq);
The coordinate sequence is owner by the linear ring.  So you shouldn't destroy
it here.
>    coordseq = (GEOSCoordSeq) GEOSCoordSeq_create(2, 2);   //2 points bi-dimensional
The (pointer to the) coordinate sequence you allocate here is lost...
>        coordseq = (GEOSCoordSeq) GEOSGeom_getCoordSeq(geom);
...when you overwrite it here.
hth
Jürgen
-- 
Jürgen E. Fischer         norBIT GmbH               Tel. +49-4931-918175-20
Dipl.-Inf. (FH)           Rheinstraße 13            Fax. +49-4931-918175-50
Software Engineer         D-26506 Norden               http://www.norbit.de
-- 
norBIT Gesellschaft fuer Unternehmensberatung und Informationssysteme mbH
Rheinstrasse 13, 26506 Norden
GF: Jelto Buurman, HR: Amtsgericht Emden, HRB 5502
    
    
More information about the geos-devel
mailing list