pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: James Orr <james@orrwhat.net>
To: Tim Perdue <tim@perdue.net>
To: Larry Rosenman <ler@lerctr.org>
Cc: pgsql-general@postgresql.org
Cc: pgsql-sql@postgresql.org
Subject: Re: [SQL] Latitude / Longitude
Date: Thu, 12 Sep 2002 18:10:01 -0400
Message-ID: <200209121810.01389.james@orrwhat.net> (raw)
In-Reply-To: <20020912144957.F27651@mail.perdue.net>
References: <20020912124426.A27570@mail.perdue.net>
	<1031852961.380.20.camel@lerlaptop.iadfw.net>
	<20020912144957.F27651@mail.perdue.net>

On Thursday 12 September 2002 15:49, Tim Perdue wrote:
> On Thu, Sep 12, 2002 at 12:49:21PM -0500, Larry Rosenman wrote:
> > Look at contrib/earthdistance, I **think** it does what you need.
>
> Thanks, yeah this starts to get me into the realm of what I need. It still
> has to run every possible permutation to figure out which one is closest
> for each postalcode. What I'll do is run that once and build a 3rd table
> which can be used to join the other two together using a view.

If you are looking for everything within a certain radius of a zip code, what 
I have done in the past is calculate the highest/lowest longitude and 
latitude and then select anything that falls between them and only check 
those ones to see if they fall within the radius.

That's saves a lot of time over checking the exact distance for every zip 
code.

- James



view thread (8+ messages)  latest in thread

Message-ID: <200209121810.01389.james@orrwhat.net>
Permalink:  ../200209121810.01389.james@orrwhat.net/
Also on:    postgresql.org/message-id/200209121810.01389.james@orrwhat.net

 · 

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: james@orrwhat.net, tim@perdue.net, ler@lerctr.org, pgsql-general@postgresql.org
  Subject: Re: [SQL] Latitude / Longitude
  In-Reply-To: <200209121810.01389.james@orrwhat.net>

* 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