Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 65F38475BEC; Thu, 12 Sep 2002 13:49:26 -0400 (EDT) Received: from lerlaptop.iadfw.net (lerlaptop.iadfw.net [206.66.13.21]) by postgresql.org (Postfix) with ESMTP id E14FA475A9E; Thu, 12 Sep 2002 13:49:25 -0400 (EDT) Received: from localhost (localhost [127.0.0.1]) by lerlaptop.iadfw.net (8.12.6/8.12.5) with ESMTP id g8CHnLLa056987; Thu, 12 Sep 2002 12:49:21 -0500 (CDT) (envelope-from ler@lerctr.org) Subject: Re: [SQL] Latitude / Longitude From: Larry Rosenman To: Tim Perdue Cc: pgsql-general@postgresql.org, pgsql-sql@postgresql.org In-Reply-To: <20020912124426.A27570@mail.perdue.net> References: <20020912124426.A27570@mail.perdue.net> Content-Type: text/plain Content-Transfer-Encoding: 7bit X-Mailer: Ximian Evolution 1.0.8 Date: 12 Sep 2002 12:49:21 -0500 Message-Id: <1031852961.380.20.camel@lerlaptop.iadfw.net> Mime-Version: 1.0 X-Virus-Scanned: by amavisd-milter (http://amavis.org/) X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200209/505 X-Sequence-Number: 30086 Look at contrib/earthdistance, I **think** it does what you need. LER On Thu, 2002-09-12 at 12:44, Tim Perdue wrote: > Hi Folks - > > I'm working on a global weather database for a client and have hit an issue > which I'm sure has been solved before. Unfortunately, the site search doesn't > pull up anything. > > Essentially, I've got two tables, one with city/county/lat/long and another > with lat/long/weather data. > > None of the lat/longs in the two tables match up directly, so I can't do a > simple join of the two tables. I need to join on closest proximity on the > lat/long fields. > > Any suggestions? It seems to me this will be pretty expensive on CPU resources > unless there's a really elegant trick uncovered. > > Tim > > -- > Founder - PHPBuilder.com / Geocrawler.com / SourceForge > GPG Public Key: http://www.perdue.net/personal/pgp.php > Perdue, Inc. / Immortal LLC > 515-554-9520 -- Larry Rosenman http://www.lerctr.org/~ler Phone: +1 972-414-9812 E-Mail: ler@lerctr.org US Mail: 1905 Steamboat Springs Drive, Garland, TX 75044-6749