[postgis-users] st_intersects() returns false with point and polygon that obviously intersect

Arnold Helmut Engelmann ahe at dhi.us
Wed Feb 23 16:32:25 PST 2011


Perhaps it's a precision issue? If you parse these into a single precision floating point number, they are equal (all the longitude values anyway-the latitude is only equal on one boundary). Not sure if this would be a PostGIS or PostgreSQL problem.

Arnold

From: postgis-users-bounces at postgis.refractions.net [mailto:postgis-users-bounces at postgis.refractions.net] On Behalf Of Craig de Stigter
Sent: Wednesday, February 23, 2011 15:58
To: postgis-users at postgis.refractions.net
Subject: [postgis-users] st_intersects() returns false with point and polygon that obviously intersect

Hi list

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)

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

Any ideas? Thanks

Craig de Stigter

--
Koordinates Ltd
PO Box 1604, Shortland St, Auckland, New Zealand
Phone +64-9-966 0433 Fax +64-9-969 0045
Web http://www.koordinates.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20110223/77971623/attachment.html>


More information about the postgis-users mailing list