Opened 16 years ago

Closed 15 years ago

#12 closed defect (invalid)

precision problem in ST_Intersection

Reported by: christiangda Owned by:
Priority: medium Milestone:
Component: postgis Version:
Keywords: Cc:

Description (last modified by pramsey)

What steps will reproduce the problem?

  1. SELECT ST_AsText(ST_Intersection('LINESTRING(-66.8592

10.4907,-66.8588928796312 10.4906674142301)','LINESTRING(-66.8590087637651 10.4910388060935,-66.8590911623889 10.4902621942468,-66.8591038797479 10.4901559438629)'));

  1. SELECT (ST_Intersects('POINT(-66.8590464398156

10.490683707115)','LINESTRING(-66.8592 10.4907,-66.8588928796312 10.4906674142301)'));

  1. SELECT (ST_Intersects('POINT(-66.8590464398156

10.490683707115)','LINESTRING(-66.8590087637651 10.4910388060935,-66.8590911623889 10.4902621942468,-66.8591038797479 10.4901559438629)'));

What is the expected output? What do you see instead? step 1: one point (correct) →'POINT(-66.8590464398156 10.490683707115)' step 2: true value (incorrect) → false step 3: true value (incorrect) → false

I have detected a problem with the function ST_Intersection(geometry, geometry), it return a bad value when you use it with two LINESTRING object, the return POINT is incorrect.

In step 2 and 3, i try to check it, but i got bad return value (false)

Then I veryfied it in OpenJump tools (, see attachment image file. You can see the problem!.

What version of the product are you using? On what operating system?

SELECT postgis_full_version(): 'POSTGIS='1.3.2' GEOS='3.0.0-CAPI-1.4.1' PROJ='Rel. 4.5.0, 22 Oct 2006' USE_STATS'

SELECT version(): 'PostgreSQL 8.2.6 on x86_64-redhat-linux-gnu, compiled by GCC gcc (GCC) 4.1.2 20070925 (Red Hat 4.1.2-33)'

Please provide any additional information below.

I think if you use float8 in your postgis-geos-postgresql wrapper function, maybe it could be resolved.

Change History (5)

comment:1 by mcayland, 15 years ago


Have you tried this again with the latest PostGIS 1.3.5 and GEOS 3.0.3? There are a number of precision fixes which may help you.



comment:2 by christiangda, 15 years ago


I tried with the new version and got the same result.

SELECT postgis_full_version(); 'POSTGIS='1.3.5' GEOS='3.0.3-CAPI-1.4.2' PROJ='Rel. 4.6.1, 21 August 2008' USE_STATS (procs from 1.3.4 need upgrade)'

SELECT version(); 'PostgreSQL 8.3.5 on x86_64-unknown-linux-gnu, compiled by GCC gcc (GCC) 4.3.0 20080428 (Red Hat 4.3.0-8)'

regards, Christian

comment:3 by robe, 15 years ago

I'm not sure this is fixable isn't this the same issue as was brought up in this thread

comment:4 by pramsey, 15 years ago

Description: modified (diff)
Resolution: invalid
Status: newclosed

Intersection ops don't operate in a real number domain, they operate in a fixed precision domain that is at best constrained by IEEE double.

Note: See TracTickets for help on using tickets.