[postgis-users] ERROR: couldnt parse object in GEOMETRY

Michael O'Sullivan mos at i3sp.com
Sun Dec 22 00:12:25 PST 2002


Hi all,

I am trying to create a function which takes two points as arguments and
calls length_spheroid using the two points as LINESTRING data.

Can someone explain why

CREATE FUNCTION get_length (numeric, numeric, numeric, numeric) RETURNS
double precision AS '
SELECT length_spheroid(\'LINESTRING(-88.8869323730469
30.4190692901611,-95.3706970214844 28.9613304138184)\',
\'SPHEROID("GRS_1980",6378137,298.257222101)\');
' LANGUAGE SQL;

works, but

CREATE FUNCTION get_length (numeric, numeric, numeric, numeric) RETURNS
numeric AS '
SELECT length_spheroid(\'LINESTRING($1 $2, $3 $4)\',
\'SPHEROID("GRS_1980",6378137,298.257222101)\');
' LANGUAGE SQL;

does not?

When I try and use function arguments as the values to the LINESTRING
definition, I get

"ERROR:  couldnt parse object in GEOMETRY"

I have tried enclosing the LINESTRING($1 $2, $3 $4) call with a 
GeometryFromText call, but I still get GEOMETRY parse errors.

I have searched the mailing list archive and found a mail from a while 
back indicating you couldn't create the LINESTRING objects in the server 
- is that what is going on here?

 > The $60000 question: at the moment, you cannot do so within the
 > database. I think a better bet would be for us to get a
 > distance(<geometry>,<geometry>) function in there ASAP. What say you,
 > Dave?

 >Ted Rolle wrote:
 >>
 >> How do I make a LINESTRING from two POINTs?  What I want to do is 
get the
 >> {length2d|length3d} of this LINESTRING to determine the distance between
 >> two points.
 >>
 >> Ted



thanks,


Michael

-- 
Michael O'Sullivan <mos at i3sp.com>
"A good man always knows his limitations" - HC




More information about the postgis-users mailing list