Re: locating cities within a radius of another

From: Oliver Kohll - Mailing Lists <oliver(dot)lists(at)gtwm(dot)co(dot)uk>
To: Geoffrey <lists(at)serioustechnology(dot)com>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: locating cities within a radius of another
Date: 2010-07-22 18:25:43
Message-ID: D8CB1FE2-4D59-45C1-A4FF-F0A72D3383E7@gtwm.co.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


On 22 Jul 2010, at 12:57, Geoffrey wrote:

>> For completeness, the earthdistance module also provides the distance between two lat/longs, the point<@>point syntax is simple to use:
>> http://www.postgresql.org/docs/8.3/static/earthdistance.html
>
> Disgregard my last post, Surely as soon as I hit send, the light went on... I'm looking at deriving my points for point <@> point from ll_to_earth().

I constructed mine using point(longitude, latitude), where long and lat are double precision, which returns a datatype of type point. ll_to_earth() looks like it returns a datatype of type earth, so not sure if it will work. Maybe things have changed in a recent release, please let me know if so.

So an example would be
select point(-2.2171,56.8952)<@>point(-1.2833,51.6667) as miles;
miles
------------------
363.202864676916
(1 row)

Regards
Oliver Kohll

oliver(at)agilebase(dot)co(dot)uk / +44(0)7814 828608 / skype:okohll
www.agilebase.co.uk - software

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Greg Smith 2010-07-22 18:31:50 Re: How to improve performance in reporting database?
Previous Message Peter C. Lai 2010-07-22 18:18:18 Re: varchar[] or text[]