Opened 16 years ago

Closed 15 years ago

#183 closed defect (worksforme)

Different behaviours of GEOSIntersection (C API) according to the arguments order

Reported by: plx Owned by: denisem
Priority: major Milestone:
Component: Core Version: 3.0.0
Severity: Unassigned Keywords:
Cc:

Description

(sorry for my English - I am French)

Two simple geometries (LINESTRING). The first vertex of geometry 1 equals the last vertex of geometry 2 (see attached files edge1.hexwkb and edge2.hexwkb in hex-wkb format).

The call "GEOSIntersection(geometry1,geometry2)" returns a POINT geometry, with the common vertex as result.

The call "GEOSIntersection(geometry2,geometry1)" implies a segmentation fault (see "Print Screen" file with the messages of my debugger - copy/paste of the messages doesn't work)

Even if I use the C API of the library, I don't think it is linked so I put this ticket in the "Core" component

Attachments (4)

GEOSIntersection.tgz (139.7 KB ) - added by plx 16 years ago.
edge1.hexwkb (2.6 KB ) - added by plx 16 years ago.
edge2.hexwkb (15.5 KB ) - added by plx 16 years ago.
GEOSIntersection.png (144.7 KB ) - added by plx 16 years ago.

Download all attachments as: .zip

Change History (7)

by plx, 16 years ago

Attachment: GEOSIntersection.tgz added

by plx, 16 years ago

Attachment: edge1.hexwkb added

by plx, 16 years ago

Attachment: edge2.hexwkb added

by plx, 16 years ago

Attachment: GEOSIntersection.png added

comment:1 by denisem, 15 years ago

Owner: set to denisem

I attempted to recreate this issue with the svn trunk from mid-Sept, using the data files provided by the creator and my own test program that uses the C API.

Following is a snippet of the code I used, compiled against the geos_c library.

   GEOSGeometry* g1 = NULL;
   GEOSGeometry* g2 = NULL;

   g1 = GEOSGeomFromHEX_buf(wkt1,size1);
   if ( GEOSisValid(g1) )
      printf("G1 isValid\n");
   else
      printf("G1 isNotValid\n");

   g2 = GEOSGeomFromHEX_buf(wkt2,size2);

   if ( GEOSisValid(g2) )
      printf("G2 isValid\n");
   else
      printf("G2 isNotValid\n");

   GEOSGeometry* g3 = GEOSIntersection(g1,g2);
   printf("Resulting geometry is %s\n", GEOSGeomToWKT(g3));

I had no issues, and in both cases, running

./test_issue183 edge2_issue183.hexwkb edge1_issue183.hexwkb 
or
./test_issue183 edge1_issue183.hexwkb edge2_issue183.hexwkb

I received the following output:

Resulting geometry is POINT (995999.9996395111083984 1888253.5007074309978634)

Pascal - would it be possible for you to try and reproduce this issue again, using a recent trunk version of the GEOS library. If it still occurs, could you send the test program that you used?

If it doesn't re-occur in the recent trunk version, then I recommend that we close the issue.

Thanks, Denise

comment:2 by denisem, 15 years ago

Email reply received from Pascal on Nov 6th, 2008:

Denise,

I could not reproduce the issue with the original code : since April, I have updated my system (Ubuntu 7.10/8.04) and I have not saved all my source files. At that time, I was new with GEOS and I made a lot of tests (my purpose was to build a full topology with shapefiles as input data).

The issue occured with one of these files I did not keep. But my code did, more or less, the same things as yours.

Yesterday, I wrote few Python lines (for a couple of months, I have been using the GEOS libray "through" (?) the Shapely Python interface), equivalent to your code, and used the same input data and the issue does not occur any more.

And, since this summer, I am used to work with Shapely/libgeos (version 3) and I have not got any problem of this type. So, I think you can close the ticket.

comment:3 by denisem, 15 years ago

Resolution: worksforme
Status: newclosed
Note: See TracTickets for help on using tickets.