Charles, Which version of PostGIS are you using? If you are using trunk (PostGIS 2.0), those won't work since they were removed. Use ST_GeomFromText and ST_Within instead. Though I don't think that is the problem based on your error. It's hard to read you code. Please use $$ $$ quoting instead of ' that way you don't have to escape out your inner quotes. Leo http://www.postgis.us
_____ From: [email protected] [mailto:[email protected]] On Behalf Of Charles E. Deaton Sent: Tuesday, April 26, 2011 1:46 PM To: [email protected] Subject: [postgis-users] GeomFromText in a user function. I'm going to apologize up front for being a nood. I have been trying to create a user function that I can call as needed by passing in bbox coordinates. I have the standard SQL working as show below; SELECT * FROM "MyTable" t WHERE WITHIN( GeomFromText('POLYGON((5 1, 8 4, 7 3, 6 2, 5 1))'),t.geom); The above runs fine, they are not valid values based on the geom column is based on lat/lon. When I place it in a PostgreSQL function it keeps telling me "type "geomfromtext" does not exist". I have run out of ideas and can't find a lot on the net about PostgreSQL function similar to this. Below is my last attempt: CREATE OR REPLACE FUNCTION fn_Poly(double precision, double precision, double precision, double precision, double precision, double precision, double precision, double precision) RETURNS SETOF " MyTable" AS 'SELECT * FROM " MyTable" t WHERE WITHIN( GeomFromText('' || '''''''' || ''''POLYGON(('' || $5 || '' '' || $1 || '', '' || $8 || '' '' || $4 || '', '' || $7 || '' '' || $3 || '', '' || $6 || '' '' || $2 || '', '' || $5 || '' '' || $1 || ''))'')'''' || '''',t.geom)' LANGUAGE sql; Any help would be greatly appreciated. Charlie
_______________________________________________ postgis-users mailing list [email protected] http://postgis.refractions.net/mailman/listinfo/postgis-users
