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

Pedro Doria Meunier pdoria at netmadeira.com
Thu Jul 23 11:39:10 PDT 2009


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Mulone,

Openstreetmap uses a Mercator projection.
When you specify '100' you're actually saying 'give me everything
within 100 *degrees*'

You should reproject your data to the desired/applicable projection by
means of transform();

HTH,

Pedro Doria Meunier
GSM: +351 96 17 20 188
Skype: pdoriam
 



Mulone wrote:
> [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
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org

iD8DBQFKaK5G2FH5GXCfxAsRAiNvAJwND0pmRWNaODnJ0foW9uraaS1YnACfbdIX
+de0ZbKmALUpjlFbzbO/rnk=
=eWY7
-----END PGP SIGNATURE-----




More information about the postgis-users mailing list