If you don't want to work with postgis, I think you could just use a bit of sqrt
using double precision - for a circle anyway.
I did something similar for a simple target archery scoring example I
set up awhile ago.
http://www.younicycle.com/web/younicycle_com/xml-hr/ex_12_a.html
Many of the other links off this page require login/privileges - but I
believe this specific page works.
round(GREATEST(10.5 - sqrt((("xyarchery"."xx" - 200) ^ 2) +
(("xyarchery"."yy" - 200) ^ 2)) / 20, 0))
where pixels are being recorded & scored.
It's been awhile since I made this, but from recall xx - yy are not
much the same as long and lat, but recorded to account for a browser
click.
Anyway -- think about it for a minute - and the lightbulb will turn
on. Believe me - I'm no math wiz.
On Fri, May 21, 2010 at 9:22 PM, Sean Davis <sdavis2@mail.nih.gov> wrote:
>
>
> On Fri, May 21, 2010 at 9:19 PM, Frank Bax <fbax@sympatico.ca> wrote:
>>
>> I'd like to create a small database for GPS positions that are currently
>> in the format "N 42° 57.750 W 081° 37.200".
>>
>> What's an easy way to store these points and how would I query data, if
>> if the only question I need answered is:
>>
>> Which positions are within 5km of a given position; where "within" can
>> be a square or circle or whatever; accuracy is not critical (let's say
>> 0.5km) is accurate enough for my purposes.
>>
>> Are there datatypes within base install of pgsql to do this?
>>
>
> http://postgis.refractions.net/
>
> Sean
>
>
--
Mike Ellsworth