Re: Postal code radius searches

From: postgresql(at)fruru(dot)com
To: Milo Hyson <milo(at)cyberlifelabs(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Postal code radius searches
Date: 2002-02-06 19:30:20
Message-ID: Pine.LNX.4.44.0202062026180.25135-100000@mail.conostix.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, 6 Feb 2002, Milo Hyson wrote:

> figure out a fast way to locate all of the postal codes within an arbitrary
> radius of another postal code.

perhaps a "refined" brute force is ok :

1. take the point you want to calculate distances around

2. calculate the maximum and minimum latitude/longitude so that a city can
be nearer than your distance limit (equivalent to going x km/mi north,
south, east and west)

3. do a brute force search but limit yourself to the "square" (it's not
really square ;-) around your starting point.

If the distances are normally small, this should be able to use indexes on
the coordinates and probably be a lot faster already.

Hope this helps,
Tycho

--
Tycho Fruru tycho(dot)fruru(at)conostix(dot)com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Elaine Lindelef 2002-02-06 19:32:55 Re: Postal code radius searches
Previous Message wsheldah 2002-02-06 19:18:59 Re: Postal code radius searches