pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Joe Conway <joseph.conway@home.com>
To: Chris Ruprecht <chrup999@yahoo.com>
To: pgsql <pgsql-sql@postgresql.org>
Subject: Re: Search by longitude/latitude
Date: Mon, 8 Oct 2001 08:33:45 -0700
Message-ID: <00a701c1500e$9e34a8e0$6cdc10ac@jecw2k1> (raw)
References: <001a01c14ff8$e0a3cf00$5dd26383@corp.compucom.com>

> 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

Attachments:

  geodist.sql (application/octet-stream, 625B) download

view thread (4+ messages)

Message-ID: <00a701c1500e$9e34a8e0$6cdc10ac@jecw2k1>
Permalink:  ../00a701c1500e$9e34a8e0$6cdc10ac@jecw2k1/
Also on:    postgresql.org/message-id/00a701c1500e$9e34a8e0$6cdc10ac@jecw2k1

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: joseph.conway@home.com, chrup999@yahoo.com
  Subject: Re: Search by longitude/latitude
  In-Reply-To: <00a701c1500e$9e34a8e0$6cdc10ac@jecw2k1>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox