[postgis-users] geometryfromtext problem

Joel Gwynn joelman at joelman.com
Sat Apr 10 07:42:17 PDT 2004


I'm having trouble doing something I've done before.  I've got a 
geometry column, but for some reason I can't populate it.  I have a lat 
field and a long field (both floats) that i'm trying to use to populate 
the_geom like so:

update locations set the_geom=GeometryFromText('POINT (' || cast(long as 
varchar(10)) || ' ' || cast(lat as varchar(10)) || ')', -1);

which yields:

ERROR:  Function 'geometryfromtext(varchar, int4)' does not exist
        Unable to identify a function that satisfies the given argument 
types
        You may need to add explicit typecasts

I've tested GeometryFromText with a generic string like so:

select GeometryFromText('POINT (-69.97844 41.929119)',-1);

which works:

          geometryfromtext
------------------------------------
 SRID=-1;POINT(-69.97844 41.929119)
(1 row)

and I'm pretty sure my geometry column is defined correctly:

            Table "locations"
   Column    |       Type       | Modifiers
-------------+------------------+-----------
 lat         | double precision | not null
 long        | double precision | not null
 the_geom    | geometry         |
Check constraints: "$1" (srid(the_geom) = -1)
                   "$2" ((geometrytype(the_geom) = 'POINT'::text) OR 
(the_geom IS NULL))

I think I'm just not building the WKT point string correctly.





More information about the postgis-users mailing list