Re: Postal code radius searches - Mailing list pgsql-general

From postgresql@fruru.com
Subject Re: Postal code radius searches
Date
Msg-id Pine.LNX.4.44.0202062026180.25135-100000@mail.conostix.com
Whole thread Raw
In response to Postal code radius searches  (Milo Hyson <milo@cyberlifelabs.com>)
List 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.fruru@conostix.com



pgsql-general by date:

Previous
From: wsheldah@lexmark.com
Date:
Subject: Re: Postal code radius searches
Next
From: "P.J. \"Josh\" Rovero"
Date:
Subject: Re: Postal code radius searches