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

From Sykora, Dale
Subject Re: Postal code radius searches
Date
Msg-id E7BC9AA1C77D634D8255A878AB49B09D02330EA1@cceexc19.americas.cpqcorp.net
Whole thread Raw
In response to Postal code radius searches  (Milo Hyson <milo@cyberlifelabs.com>)
List pgsql-general
You could expand on this solution by including points where x&y are +&-
.707*r and calulating points between .707r and r.  Basically draw a
square inside the radius circle and outside it.  Points between these
squares need calculating, points withing both squares do not.  This will
change slightly as x & y are not linear so you are dealing with
rectangles/ellipses instead of circle/squares.

> -----Original Message-----
> From: postgresql@fruru.com [mailto:postgresql@fruru.com]
> Sent: Wednesday, February 06, 2002 1:30 PM
> To: Milo Hyson
> Cc: pgsql-general@postgresql.org
> Subject: Re: [GENERAL] Postal code radius searches
>
>
> 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
>
>
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to
> majordomo@postgresql.org
>

pgsql-general by date:

Previous
From: Stephan Szabo
Date:
Subject: Re: Indexs and prolems with.
Next
From: Tom Lane
Date:
Subject: Re: Indexs and prolems with.