[prev in list] [next in list] [prev in thread] [next in thread] 

List:       postgis-users
Subject:    Re: [postgis-users] st_intersects() returns false with point
From:       Arnold Helmut Engelmann <ahe () dhi ! us>
Date:       2011-02-24 0:32:25
Message-ID: AC8CAB962DA65D419B5F4A74EFA670194030C09D () PDXMAIL ! dhi ! us
[Download RAW message or body]

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@postgis.refractions.net \
                [mailto:postgis-users-bounces@postgis.refractions.net] On Behalf Of \
                Craig de Stigter
Sent: Wednesday, February 23, 2011 15:58
To: postgis-users@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


[Attachment #3 (text/html)]

<html xmlns:v="urn:schemas-microsoft-com:vml" \
xmlns:o="urn:schemas-microsoft-com:office:office" \
xmlns:w="urn:schemas-microsoft-com:office:word" \
xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" \
xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type \
content="text/html; charset=us-ascii"><meta name=Generator content="Microsoft Word 14 \
(filtered medium)"><style><!-- /* Font Definitions */
@font-face
	{font-family:Calibri;
	panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
	{font-family:Tahoma;
	panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
	{margin:0in;
	margin-bottom:.0001pt;
	font-size:12.0pt;
	font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
	{mso-style-priority:99;
	color:blue;
	text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
	{mso-style-priority:99;
	color:purple;
	text-decoration:underline;}
span.EmailStyle17
	{mso-style-type:personal-reply;
	font-family:"Calibri","sans-serif";
	color:#1F497D;}
.MsoChpDefault
	{mso-style-type:export-only;
	font-family:"Calibri","sans-serif";}
@page WordSection1
	{size:8.5in 11.0in;
	margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
	{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=EN-US link=blue vlink=purple><div \
class=WordSection1><p class=MsoNormal><span \
style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Perhaps \
it&#8217;s a precision issue? If you parse these into a single precision floating \
point number, they are equal (all the longitude values anyway&#8212;the latitude is \
only equal on one boundary). Not sure if this would be a PostGIS or PostgreSQL \
problem.<o:p></o:p></span></p><p class=MsoNormal><span \
style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p>&nbsp;</o:p></span></p><p \
class=MsoNormal><span \
style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Arnold<o:p></o:p></span></p><p \
class=MsoNormal><span \
style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p>&nbsp;</o:p></span></p><p \
class=MsoNormal><b><span \
style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span \
style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> \
postgis-users-bounces@postgis.refractions.net \
[mailto:postgis-users-bounces@postgis.refractions.net] <b>On Behalf Of </b>Craig de \
Stigter<br><b>Sent:</b> Wednesday, February 23, 2011 15:58<br><b>To:</b> \
postgis-users@postgis.refractions.net<br><b>Subject:</b> [postgis-users] \
st_intersects() returns false with point and polygon that obviously \
intersect<o:p></o:p></span></p><p class=MsoNormal><o:p>&nbsp;</o:p></p><p \
class=MsoNormal>Hi list<o:p></o:p></p><div><p \
class=MsoNormal><o:p>&nbsp;</o:p></p></div><div><p class=MsoNormal>This query returns \
false, but the box and point intersect:<o:p></o:p></p></div><div><p \
class=MsoNormal><o:p>&nbsp;</o:p></p></div><div><blockquote \
style='border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in \
6.0pt;margin-left:4.8pt;margin-right:0in'><p class=MsoNormal><span \
style='font-family:"Courier New"'>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);<br>&nbsp;st_intersects&nbsp;<br>---------------<br>&nbsp;f<br>(1 \
row)</span><o:p></o:p></p></blockquote><div><p \
class=MsoNormal><o:p>&nbsp;</o:p></p></div><div><p class=MsoNormal>Tested on postgis \
1.5.2. postgis_version():&nbsp;1.5 USE_GEOS=1 USE_PROJ=1 \
USE_STATS=1<o:p></o:p></p></div><div><p \
class=MsoNormal><o:p>&nbsp;</o:p></p></div><div><p class=MsoNormal>Using geos via \
python it works:<o:p></o:p></p></div><div><p \
class=MsoNormal><o:p>&nbsp;</o:p></p></div><div><blockquote \
style='border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in \
6.0pt;margin-left:4.8pt;margin-right:0in'><p class=MsoNormal><span \
style='font-family:"Courier New"'>&gt;&gt;&gt; from django.contrib.gis import \
geos<br>&gt;&gt;&gt; p = geos.GEOSGeometry('POLYGON((169.699607857174 \
-46.5061218662,169.699607857174 -46.5061195965597,169.699608806526 \
-46.5061195965597,169.699608806526 -46.5061218662,169.699607857174 \
-46.5061218662))')<br>&gt;&gt;&gt; pt = geos.GEOSGeometry('POINT(169.69960846592 \
-46.5061209281002)')<br>&gt;&gt;&gt; \
pt.intersects(p)<br>True</span><o:p></o:p></p></blockquote></div><div><p \
class=MsoNormal><o:p>&nbsp;</o:p></p></div><div><p class=MsoNormal>Any ideas? \
Thanks<o:p></o:p></p></div><div><p class=MsoNormal><o:p>&nbsp;</o:p></p></div><div><p \
class=MsoNormal>Craig de Stigter<o:p></o:p></p></div><div><p \
class=MsoNormal><o:p>&nbsp;</o:p></p></div><p class=MsoNormal>-- <br>Koordinates \
Ltd<br>PO Box 1604, Shortland St, Auckland, New Zealand<br>Phone +64-9-966 0433 Fax \
+64-9-969 0045<br>Web <a \
href="http://www.koordinates.com">http://www.koordinates.com</a><o:p></o:p></p></div></div></body></html>




_______________________________________________
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users

--===============8079430801383130734==--

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic