X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (neptune.hub.org [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id C4375D1B432 for ; Sat, 27 Dec 2003 04:34:55 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 80962-04 for ; Sat, 27 Dec 2003 00:34:06 -0400 (AST) Received: from wolff.to (wolff.to [66.93.249.74]) by svr1.postgresql.org (Postfix) with SMTP id 4AEBBD1B42F for ; Sat, 27 Dec 2003 00:34:05 -0400 (AST) Received: (qmail 30603 invoked by uid 500); 27 Dec 2003 04:34:04 -0000 Date: Fri, 26 Dec 2003 22:34:04 -0600 From: Bruno Wolff III To: Michael Fuhr Cc: Andy Lewis , pgsql-sql@postgresql.org Subject: Re: Radius of a zip code Message-ID: <20031227043404.GB5264@wolff.to> Mail-Followup-To: Michael Fuhr , Andy Lewis , pgsql-sql@postgresql.org References: <000b01c3cc09$e043fd70$0201a8c0@andy2> <20031226194244.A15916@quality.qadas.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20031226194244.A15916@quality.qadas.com> User-Agent: Mutt/1.5.4i X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200312/195 X-Sequence-Number: 16361 On Fri, Dec 26, 2003 at 19:42:44 -0700, Michael Fuhr wrote: > > I have several databases with lat/lon coordinates and frequently make > "show me all records within a certain distance of this point" queries. > I wrote a haversine() function that uses the Haversine Formula to > calculate the great circle distance between two points on a sphere > (assuming the earth is a perfect sphere is accurate enough for my uses). > Here's a web site with related info: The distance operator in contrib/earthdistance got changed to use haversine instead of the naive formula in 7.3. In 7.4 it also provides some functions that work with contrib/cube that allow for indexed searches.