[postgis-users] Issue with spatial query (PostGIS, ST_DWithin, SRID, transform)

Mulone andrea.ballatore at ucd.ie
Thu Jul 23 11:32:10 PDT 2009


[apologies for cross posting]

Hello,
I'm running some queries on a PostGIS db containing OSM data loaded with
osm2pgsql.
I want to get the geometries within a certain distance from a point. I've
written this query:

SELECT osm_id FROM planet_osm_point WHERE
ST_DWithin(way,geomfromtext('POINT(53.30124 -6.21804 0)', 4326), 100);

where 100 is meant to be 100 meters. This query returns all the objects in
the table, and running it with different distances I found a sort of
threshold around 84.16, where I start getting less objects.

I thought it was an issue related to the system reference, so I tried with
this conversion:

SELECT osm_id FROM planet_osm_point WHERE
ST_DWithin(transform(way,2163),transform(geomfromtext('POINT(53.30124
-6.21804 0)', 4326),2163), 5740000);

The threshold in this case seems to be about 5740000, which is obviously not
meters.
How can I figure out the units DWithin is working in?
Besides, I doubt this is the best way to do what I want, any better ideas?

Thanks in advance!
Mulone
-- 
View this message in context: http://www.nabble.com/Issue-with-spatial-query-%28PostGIS%2C-ST_DWithin%2C-SRID%2C-transform%29-tp24631779p24631779.html
Sent from the PostGIS - User mailing list archive at Nabble.com.




More information about the postgis-users mailing list