[postgis-users] Updating Geometry

Asli Akarsakarya asliakar at yahoo.com
Fri Nov 11 01:15:28 PST 2011


Thank you Sandro,

The way you suggested works fine. 

Though, I wonder what I cannot see. In the geometry_columns table, when I check the geometry's SRID, it is coded as 101. And this, I give to the "GeometryFromText" function. The only thing possible is, there's another coded srid in the geometry; which doesnt match the SRID in geometry_columns table. Any other suggestions?

"enforce_srid_<Geometry_Column_Name>" is a restriction defined on the spatial table.  ("position" is the name of my column, sorry.)

Thanks again. 




________________________________
From: Sandro Santilli <strk at keybit.net>
To: Asli Akarsakarya <asliakar at yahoo.com>; PostGIS Users Discussion <postgis-users at postgis.refractions.net>
Sent: Friday, November 11, 2011 8:24 AM
Subject: Re: [postgis-users] Updating Geometry

On Thu, Nov 10, 2011 at 01:55:57PM -0800, Asli Akarsakarya wrote:
> 
> I am having trouble when attempting to update an existing geometry on a spatial table. The table stores 2D Point geometry, with the SRID 101. The update statement i am trying to use to update the geometry with the id 110 is as follows:
> 
> UPDATE <Table_Name> SET <Geometry_Column_Name> = GeometryFromText('POINT(44 31)', 101) WHERE <id_Column>=110
> 
> But I get an error that says the statement violates the "enforce_srid_position" restriction. Though the SRID's are the same.

Probably they aren't. Try:

UPDATE <Table_Name> SET <Geometry_Coumn_Name> = GeometryFromText(
'POINT(44 31)', ST_Srid(<Geometry_Column_Name>)) WHERE <id_Column>=110;

Then check what "enforce_srid_position" is
(doesn't sound like the correct name) using:

\d <Table_Name>

--strk; 

  ()   Free GIS & Flash consultant/developer
  /\   http://strk.keybit.net/services.html
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20111111/ceeeb51b/attachment.html>


More information about the postgis-users mailing list