Re: Search by longitude/latitude - Mailing list pgsql-sql

From Joe Conway
Subject Re: Search by longitude/latitude
Date
Msg-id 00a701c1500e$9e34a8e0$6cdc10ac@jecw2k1
Whole thread Raw
In response to Search by longitude/latitude  ("Chris Ruprecht" <chrup999@yahoo.com>)
List pgsql-sql
> Hi all,
>
> I need to implement "Find all hospitals in a 5 mile radius". Say I have
all
> the coordinates on them stored in a table with the fields longitude and
> latitude. Has anybody some sample code for that?
>
> Best regards,
> Chris
>

Here's a plpgsql function that will do what you need. You might also look at
the earthdistance code in contrib if you'd rather have a C function.

HTH,

Joe


pgsql-sql by date:

Previous
From: Haller Christoph
Date:
Subject: Re: How to Return Unique Elements From An Array?
Next
From: Bruce Momjian
Date:
Subject: Re: temporary views