[postgis] text -> geometry ?

Michael Scharber mscharber at josh.ucsd.edu
Fri Aug 24 11:46:37 PDT 2001


Hi there,

Can anyone help me understand how to assign a geometry field a value that
is not a string literal?  In plpgsql I'm trying the following from within
a trigger'd function:

update <table>
  set <geom_field> = ''POINT('' || x || '' '' || y || '' '' || z || '')''
  where <field> = <some_value>;

where x, y and z are float8 types.

I've also tried the following in psql directly:

update <table>
  set <geom_field> = 'POINT(' || '1' || ' ' || '2' || ' ' || '3' || ')'
  where <field> = <some_value>;

In both cases I get
  "ERROR:  Attribute 'shape' is of type 'geometry' but expression is of type 'text'
        You will need to rewrite or cast the expression"

so I tried ('POINT(' || '1' || ' ' || '2' || ' ' || '3' || ')')::geometry
and got "ERROR:  Cannot cast type 'text' to 'geometry'".

I just started using Postgres, and PostGIS for that matter, yesterday so
I'm hoping someone can point out the blunder I'm making.

Thanks in advance.

Michael


-- 
*******************************************************
      	Michael Scharber
	Scripps Institution of Oceanography
	Institute of Geophysics and Planetary Physics
	8785 Biological Grade
	IGPP Room 4212
	La Jolla, CA 92037

	mscharber at josh.ucsd.edu
	(858)534-1750
*******************************************************


------------------------ Yahoo! Groups Sponsor ---------------------~-->
Get VeriSign's FREE GUIDE: "Securing Your Web Site for Business." Learn about using SSL for serious online security. Click Here!
http://us.click.yahoo.com/KYe3qC/I56CAA/yigFAA/PhFolB/TM
---------------------------------------------------------------------~->

To unsubscribe from this group, send an email to:
postgis-unsubscribe at yahoogroups.com

 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 





More information about the postgis-users mailing list