Re: Earth distance - Mailing list pgsql-general

From Bruno Wolff III
Subject Re: Earth distance
Date
Msg-id 20030327130530.GA27884@wolff.to
Whole thread Raw
Responses Re: Earth distance  (Stephan Szabo <sszabo@megazone23.bigpanda.com>)
List pgsql-general
On Wed, Mar 26, 2003 at 18:29:42 -0600,
  Tad Marko <tad@tadland.net> wrote:
> Bruno,
>
> I aplogize for bothering you direclty, but I'm having some difficulty with
> some syntax using the earth distance functions. Every single example I can
> find is using hard coded constants for the latitude and longitude, but I'm
> trying to use a join to get these values. Basically, what I'm trying to do
> is:
>
> select up.first_name, up.last_name, up.city, zip_code from user_primary as
> up, ziplocs as zl where zl.zip=up.zip_code::integer and '(33.0, 97.1)'::point
> <@> '(zl.lat, zl.lon)'::point < 50;
>
> But this fails with a
>
> ERROR:  Bad point external representation '(zl.lat, zl.lon)'
>
> message. I simply cannot figure out how to specify the lat and lon values
> from the joined table. Can you offer any suggestions?

The best thing would be to store the lat and lon as point in the table
instead of in separate float columns. You can extra the lat and lon
using subscripts if you need them broken out.

You really want to ask questions like this on one of the postgres lists.
Just because I have touched the earthdistance code doesn't make me the
foremost expert on it. Also there may be periods of time when I am
not able to respond to questions, when someone on the lists might have
been able to provide you with an answer promptly.


pgsql-general by date:

Previous
From: Richard Huxton
Date:
Subject: Re: indexes
Next
From: Stephan Szabo
Date:
Subject: Re: Earth distance