geo_distance radius question

From: Mark Stosberg <mark(at)summersault(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: geo_distance radius question
Date: 2000-01-22 18:06:39
Message-ID: 3889F141.4540F4B5@summersault.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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/

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 2000-01-22 18:07:47 Re: [SQL] More efficient DELETE ... ?
Previous Message Bruce Momjian 2000-01-22 17:56:59 Re: [SQL] More efficient DELETE ... ?