Re: Zip Code Proximity

From: Paul Dlug <paul(at)nerdlabs(dot)com>
To: Dustin Sallings <dustin(at)spy(dot)net>
Cc: pgsql-general(at)hub(dot)org
Subject: Re: Zip Code Proximity
Date: 2000-05-20 01:31:33
Message-ID: 3925EAF5.7C8E7D92@nerdlabs.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Does anyone happen to have a copy of the zips.zip file from the census
bureau? Their FTP server is uncooperative.

Dustin Sallings wrote:
>
> On Thu, 18 May 2000, Jeff Hoffmann wrote:
>
> I tried to get a few permutations of that to work, but with no
> luck. The following will give a list of all places sorted by how far away
> from my house they are:
>
> select zipcode, city, state, point(latitude, longitude) as point
> from zips
> order by point_distance(location_of(95051), point(latitude,longitude))
>
> I defined the function location_of for my own convenience:
>
> create function location_of(integer) returns point as
> 'select point(latitude, longitude) from zips where zipcode = $1 '
> language 'sql'
>
> # > select zip, location <@> '(lat, lon)'::box
> # > from zipcodes
> # > order by location <@> '(lat, lon)'::box
> # > limit 10;
> # >
> #
> # oops, typo. those boxes should be points. plus, it looks like you can
> # get zipcodes & lat-longs from the census at:
> #
> # http://ftp.census.gov/geo/www/gazetteer/places.html
> #
> #
>
> --
> dustin sallings The world is watching America,
> http://2852210114/~dustin/ and America is watching TV.

--
Paul Dlug
Unix/Web Programmer

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Bruce Momjian 2000-05-20 01:46:43 Re: Performance (was: The New Slashdot Setup (includes MySql server))
Previous Message Tom Lane 2000-05-20 00:32:18 Re: Performance (was: The New Slashdot Setup (includes MySql server))