pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Mark Stosberg <mark@summersault.com>
To: pgsql-sql@postgresql.org
Subject: geo_distance radius question
Date: Sat, 22 Jan 2000 13:06:39 -0500
Message-ID: <3889F141.4540F4B5@summersault.com> (raw)


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/



Message-ID: <3889F141.4540F4B5@summersault.com>
Permalink:  ../3889F141.4540F4B5@summersault.com/
Also on:    postgresql.org/message-id/3889F141.4540F4B5@summersault.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: mark@summersault.com
  Subject: Re: geo_distance radius question
  In-Reply-To: <3889F141.4540F4B5@summersault.com>
  References: <3889F141.4540F4B5@summersault.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox