Re: Zip Code Proximity

Поиск
Список
Период
Сортировка
От Dustin Sallings
Тема Re: Zip Code Proximity
Дата
Msg-id Pine.NEB.4.10.10005181925050.279-100000@foo.west.spy.net
обсуждение исходный текст
Ответ на Re: Zip Code Proximity  (Jeff Hoffmann <jeff@propertykey.com>)
Ответы Does Order by support case?  (Lincoln Yeoh <lylyeoh@mecomb.com>)
Список pgsql-general
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.


В списке pgsql-general по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: PostgreSQL cleartext passwords
Следующее
От: Lincoln Yeoh
Дата:
Сообщение: Re: Can postgres saving file ?