[postgis-users] help with distance query

Jean David TECHER david.techer at davidgis.fr
Wed Oct 15 07:21:53 PDT 2008


Try this:

select astext(the_geom),  distance_spheroid(GeomFromText('Point(-70
20)',4326),the_geom,'SPHEROID["WGS 84",6378137,298.257223563]') from  
azev2_1  group  by 1,2 having  distance_spheroid(GeomFromText('Point(-70
20)',4326),the_geom,'SPHEROID["WGS 84",6378137,298.257223563]') <
250000;

hope this helps!!!

--david;


Quoting mark balman <mark.balman at gmail.com>:

> Hi all
>
> I am trying to work out how to return the distances from a user
> defined location but not too sure how. My query follows;
>
> select * from azev2_1 where distance_spheroid(GeomFromText('Point(-70
> 20)',4326),the_geom,'SPHEROID["WGS 84",6378137,298.257223563]') <
> 250000;
>
> This provides all the point features located within 250000 metres of
> the coordinates -70, 20 but how do I return the distances that each
> feature is away from those coordinates?
>
> Any ideas would be much appreciated.
>
> Many thanks
>
> Mark
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
>
>



===================
Jean David TECHER
www.davidgis.fr
06 60 46 85 05
04 99 77 16 87
===================




More information about the postgis-users mailing list