[postgis-users] Distance between points

Marcelo Pereira marcelops at gmail.com
Sun Aug 28 10:22:53 PDT 2011


Hello Everybody,

I have got a very simple question about distance between two points:

I have the following table:

CREATE TABLE places (
>    id   SERIAL,
>    latitude  DOUBLE PRECISION,
>    longitude DOUBLE PRECISION
> );
>

with the following content:

geo=# SELECT * FROM places;
 id | latitude  | longitude
----+-----------+------------
  1 | 42.331002 |  -71.112678
  2 | 42.335158 |  -71.102464
  3 | 33.911400 | -116.768000
  4 | 40.415748 |   -3.707135
  5 | 35.684750 |  139.751158
(5 rows)

I would like to know the distance between "one fixed point" (42.331002
-71.112678) and all points in this table.

Simple like this!! Could someone help me?

For now, I don't need to considere zones!! I just need to compare "one
point" against all points in the table!!

Thanks in advance,
Marcelo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20110828/46ae35fe/attachment.html>


More information about the postgis-users mailing list