[postgis-users] Precision of the bounding box query

Alexander Ulanov avulanov at gmail.com
Sun Sep 1 13:21:43 PDT 2013


Hi!

I have a spatial db of cities and places inside Postgis v1.5. I've built a
gist index on location column and run a bounding box query. However, I
noticed a strange behavior: results of queries with huge bounding boxes are
very imprecise.

For example, the first query returns Sagrada Familia (longitude ~2 and
latitude ~41) and second doesn't, although 41 is inside both 34..68 and
35..69.
1)select name from places where location && ST_setSRID(ST_MakeBox2d
(ST_Point(57,34), ST_Point(-28,68)),4326) and name like 'Sagrada%';

      name       |                st_astext
-----------------+------------------------------------------
 Sagrada Família | POINT(2.17434883117676 41.4035152693628)

2)select name from places where location && ST_setSRID(ST_MakeBox2d
(ST_Point(57,35), ST_Point(-28 69)),4326) and name like 'Sagrada%';

name | st_astext
------+-----------
(0 rows)

Could you explain what is the reason for this and how to fix it?


Best regards, Alexander
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20130902/d46b90cc/attachment.html>


More information about the postgis-users mailing list