geo_distance radius question - Mailing list pgsql-sql

From Mark Stosberg
Subject geo_distance radius question
Date
Msg-id 3889F141.4540F4B5@summersault.com
Whole thread Raw
List pgsql-sql
Hello!

I'm writing regarding your earthdistance postgres extension (included in
the standard distro of 6.5.3). I would
like to use it as part of a geo spatial search engine I'm using to help
folks find resources related to skateparks on http://www.skatepark.org/ 

I got it installed, and the test script ran fine, but I'm running into a
syntax issue. I'm guessing the fault has to be with me being to new using
postgres extensions and working with custom operators. 

So want I want to do is to find all the zipcodes that are within a
radius of 500 miles of an initial zipcode. So geo_distance code installed,
I put together a statement like this:

SELECT zipcode,latitude,longitude,city,state_abbrev from zip 
WHERE  (geo_distance
('(117.59408,34.107039)'::point,'(longitude,latitude)'::point) < 500 ).

I also tried this:
SELECT zipcode,latitude,longitude,city,state_abbrev from zip WHERE ('(117.59408,34.107039
)'::point <@> '(longitude,latitude)'::point) < 500;

However, I get this response back in both cases
"ERROR:  Bad point external representation '(longitude,latitude)"

So it appears postgres may be taking the words 'longitude' and
'latitude' literal there, when I really want it to refer to values for
those columns. 

It seems like there's a straightforward solution, but I'm missing it. 

Do you have any suggestions? Thanks!
  -mark
 <<-------------------------------------------------------------->>
personal website                <    Summersault Website Design  http://mark.stosberg.com/     >
http://www.summersault.com/


pgsql-sql by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: [SQL] More efficient DELETE ... ?
Next
From: Tom Lane
Date:
Subject: Re: [SQL] More efficient DELETE ... ?