<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content="text/html; charset=iso-8859-1" http-equiv=Content-Type>
<META name=GENERATOR content="MSHTML 8.00.6001.19393"></HEAD>
<BODY>
<DIV dir=ltr align=left><SPAN class=201085907-02022013><FONT color=#0000ff 
size=2 face=Tahoma>Hi,</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=201085907-02022013><FONT color=#0000ff 
size=2 face=Tahoma></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=201085907-02022013><FONT color=#0000ff 
size=2 face=Tahoma>I think this is a tolerance issue. If you 
try</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=201085907-02022013><FONT color=#0000ff 
size=2 face=Tahoma></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=201085907-02022013><FONT color=#0000ff 
size=2 face=Tahoma>select 
st_distance(ST_MakeEnvelope(-105.17353271032549,39.798766541338225,-105.07765728967452,39.83016145866177,4326), 
</FONT></SPAN><SPAN class=201085907-02022013><FONT color=#0000ff size=2 
face=Tahoma>st_setsrid(ST_MakePOint(-105.130637 
,39.830165),4326))</FONT></SPAN></DIV>
<DIV><SPAN class=201085907-02022013><FONT color=#0000ff size=2 
face=Tahoma></FONT></SPAN> </DIV>
<DIV><SPAN class=201085907-02022013><FONT color=#0000ff size=2 face=Tahoma>The 
distance is very short : 3.54133823066149e-06</FONT></SPAN></DIV>
<DIV><SPAN class=201085907-02022013><FONT color=#0000ff size=2 
face=Tahoma></FONT></SPAN> </DIV>
<DIV><SPAN class=201085907-02022013><FONT color=#0000ff size=2 face=Tahoma>And i 
you add the where clause, it is also true that your lat is not <= to the 
given one, so the single line returned with the simple && query is 
now excluded.</FONT></SPAN></DIV>
<DIV><SPAN class=201085907-02022013><FONT color=#0000ff size=2 
face=Tahoma></FONT></SPAN> </DIV>
<DIV><SPAN class=201085907-02022013><FONT color=#0000ff size=2 
face=Tahoma>Hugues.</FONT></SPAN></DIV><BR>
<DIV dir=ltr lang=fr class=OutlookMessageHeader align=left>
<HR tabIndex=-1>
<FONT size=2 face=Tahoma><B>De :</B> postgis-users-bounces@lists.osgeo.org 
[mailto:postgis-users-bounces@lists.osgeo.org] <B>De la part de</B> Pavel 
Shub<BR><B>Envoyé :</B> samedi 2 février 2013 07:14<BR><B>À :</B> 
postgis-users@lists.osgeo.org<BR><B>Objet :</B> [postgis-users] (no 
subject)<BR></FONT><BR></DIV>
<DIV></DIV>
<DIV dir=ltr>
<DIV>
<DIV>
<DIV>
<DIV>
<DIV>
<DIV>Hi all,<BR><BR></DIV>Please tell me if I'm doing something incorrectly, but 
I seem to be getting wrong results for the following bounding box 
query:<BR><BR>select * from geotest where geom && 
ST_MakeEnvelope(-105.17353271032549,39.798766541338225,-105.07765728967452,39.83016145866177,4326)<BR><BR></DIV>Given 
table with columns: name (varchar), lat (double), lon (double), geom (geometry). 
geom having srid 4326 points<BR><BR></DIV>A row with lat = 39.830165, lon = 
-105.130637 is returned. I find this very peculiar because the latitude is 
greater than the maxiumum latitude in the envelope (39.83016145866177). If I 
then add a 'and lat <= 39.83016145866177' clause, the row is no longer 
returned.<BR></DIV>I noticed this on postgres 9.1 with postgis 1.5 then when 
testing again got the same results on postgres 9.2 and postgis 2.0<BR><BR></DIV>
<DIV>Is this intended and I missed some documentation somewhere, or is this an 
issue?<BR></DIV>
<DIV><BR></DIV>Thank you,<BR></DIV>Pavel Shub</DIV></BODY></HTML>