[postgis-users] Issue with BOX3D and distance

Mulone andrea.ballatore at ucd.ie
Tue Jul 28 07:47:06 PDT 2009


Hi guys,
I've managed to make this proximity query work:

SELECT * FROM planet_osm_polygon
WHERE 
way && setsrid(box3d('BOX3D(-6.216  53.300,-6.220  53.304)'), 4326)
AND 
distance( transform( GeomFromEWKT('SRID=4326;POINT( -6.218  53.302 0)'),
32661 ),
transform( way, 32661 ) ) < 100

where 100 is a distance in meters and the bounding box is expressed in
degrees (it's always slightly bigger than what we need to be on the safe
side).
The point is that despite the use of the index, the query is still too slow
for what we need (about 60ms on a very small table).
I wonder what the problem is... Maybe we can convert meters to degress in
srid 4326 with a reasonable precision and get rid of the transform(), which
are probably slowing down everything. Is there a function to do such a
conversion directly in the postgis SQL?

Any hints?

Thanks in advance,
Mulone
-- 
View this message in context: http://www.nabble.com/Issue-with-BOX3D-and-distance-tp24699677p24699677.html
Sent from the PostGIS - User mailing list archive at Nabble.com.




More information about the postgis-users mailing list