[geos-devel] GEOSIntersection returns the input
Giacomo Piva
piva at meeo.it
Tue Aug 25 06:15:38 EDT 2009
Thank you.
Finally I get the intersection by using 2 polygons from linear ring
Jürgen E. Fischer ha scritto:
> 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
>
>
--
Giacomo
More information about the geos-devel
mailing list