Forum OpenACS Q&A: Re: Closest Address Calculation

Collapse
Posted by Sam Dau on
Thank you so much for your help and patience Russell.

I ran the current script:

select
str_num ||' '|| name AS full_address,
point_distance(the_geom, '2227284.1963667543,1435389.6730164126') as dist
from address order by dist limit 1

and now I get this:

ERROR:  function point_distance(geometry, "unknown") does not exist
HINT:  No function matches the given name and argument types. You may need to add explicit type casts.

Collapse
Posted by russ m on
hmmm... well it works for me... are you executing it from psql or from your deployment environment? if you execute "\df point_distance" from within psql do you get a result like this?

                    List of functions
 Result data type |      Name      | Argument data types 
------------------+----------------+---------------------
 double precision | point_distance | point, point
(1 row)
If it works in psql but not in your application then we can't really help you, and if your database isn't recognising the builtin point_distance function we also can't really help you... you should probably talk to the pgsql-general mailing list over at http://www.postgresql.org/lists.html...
Collapse
Posted by russ m on
hang on - it looks like the_geom is of type "geometry" not of type "point"... is that a PostGIS extension? If it is, this (again) isn't the right place to be getting answers... sorry 'bout that...