[postgis-devel] [PostGIS] #845: ST_Intersects() precision error - returns false instead of true
PostGIS
trac at osgeo.org
Thu Feb 24 01:05:39 PST 2011
#845: ST_Intersects() precision error - returns false instead of true
------------------------+---------------------------------------------------
Reporter: cdestigter | Owner: pramsey
Type: defect | Status: new
Priority: medium | Milestone: PostGIS 2.0.0
Component: postgis | Version: 1.5.X
Keywords: |
------------------------+---------------------------------------------------
This query returns false, but the box and point intersect:
{{{
select st_intersects('POINT(169.69960846592 -46.5061209281002)'::geometry,
'POLYGON((169.699607857174 -46.5061218662,169.699607857174
-46.5061195965597,169.699608806526 -46.5061195965597,169.699608806526
-46.5061218662,169.699607857174 -46.5061218662))'::geometry);
st_intersects
---------------
f
(1 row)
}}}
More info:
{{{
st_relate | st_intersects | st_disjoint
-----------+---------------+-------------
0FFFFF212 | f | f
ST_Relate is correct, ST_Disjoint is correct, ST_Intersects is _wrong_
I B E
-----
I 0 F F
B F F F
E 2 1 2
}}}
Tested on postgis 1.5.2. postgis_version(): 1.5 USE_GEOS=1 USE_PROJ=1
USE_STATS=1
Using geos via python it works:
{{{
>>> from django.contrib.gis import geos
>>> p = geos.GEOSGeometry('POLYGON((169.699607857174
-46.5061218662,169.699607857174 -46.5061195965597,169.699608806526
-46.5061195965597,169.699608806526 -46.5061218662,169.699607857174
-46.5061218662))')
>>> pt = geos.GEOSGeometry('POINT(169.69960846592 -46.5061209281002)')
>>> pt.intersects(p)
True
}}}
Probably a precision error, since this polygon is very small.
[http://postgis.refractions.net/pipermail/postgis-
users/2011-February/028965.html postgis-users thread]
--
Ticket URL: <http://trac.osgeo.org/postgis/ticket/845>
PostGIS <http://trac.osgeo.org/postgis/>
The PostGIS Trac is used for bug, enhancement & task tracking, a user and developer wiki, and a view into the subversion code repository of PostGIS project.
More information about the postgis-devel
mailing list