Re: Finding points within 50 miles - Mailing list pgsql-general

From Vivek Khera
Subject Re: Finding points within 50 miles
Date
Msg-id 969488A8-E0AD-45E9-98EF-581AFF21F2FC@khera.org
Whole thread Raw
In response to Re: Finding points within 50 miles  (Janning Vygen <vygen@gmx.de>)
List pgsql-general
On Jun 27, 2005, at 3:47 AM, Janning Vygen wrote:

> I had some problems with the calculation inside acos() sometimes
> being greater
> than 1, which should not occur. Please use a
>    CASE WHEN sin(...) > 1 THEN 1 ELSE sin(...) END
> if you have the same problem.
>

We've seen this as well with the distance radius calculation.  It
doesn't happen in 8.x but did happen 7.4, and then was easily worked
around by reducing the precision of the arguments.  Ie, we would use
73.13 rather than 73.1343593421 as pulled from the database for the
lat/lon values of the center point.

In any case, I urge you to derive the formulas yourself from basic
research so you *know* you're getting what you think you're getting.

Vivek Khera, Ph.D.
+1-301-869-4449 x806



Attachment

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: number of records returned by cursors
Next
From: Vivek Khera
Date:
Subject: Re: Finding points within 50 miles