[postgis-users] Updating the values of a geometry field using SQL UPDATE statement not reflected

Kiti Chigiri kiti.chigiri at bridgeinternationalacademies.com
Wed Oct 26 10:20:02 PDT 2011


Hi

I have set up a GIS enabled application that stores the values of multiple
points by converting them to a polygon using the ST_convexhull function..

A sample of the INSERT script is as follows

*insert into plots(name, the_geometry, modified)
values('test', ST_Convexhull(ST_GeomFromText('MULTIPOINT(36.12826381
0.299545,36.12817 0.29958,36.12856 0.29968,36.12844 0.28449)', 4326), now())
.*

The INSERT  script above works as expected and stores the spatial data
without any errors. In another part of the application, I run an update
query  to modify the values of the geometry field to reflect changes in the
longitude and latitude values using a sample SQL statement as below:

*UPDATE plots set modified = NOW(), the_geom =
ST_Convexhull(ST_GeomFromText('MULTIPOINT(36.121111 0.209960,36.12817
0.29958,36.12856 0.29968,36.12844 0.28449)', 4326)) where id=1;*

The UPDATE script above executes without throwing any error and updates
other fields in the row BUT the values of the geometry field are not updated
i.e. when i run a select query on the original record, the points are listed
as 36.12826381 0.29954582,36.12817 0.29958,36.12856 0.29968,36.12844
0.28449. , which are the original values

My setup is postgres 8.4 and  postgis 1.5 running on  Ubuntu 11.0 Desktop(32
bit) OS. All SQLscripts above are dynamically generated by  a PHP script
that parses the values of a HTTP POST'ed form.

What am i missing here or  what am i doing wrong? Is there another way to
update the values of the geometry field without resorting to deleting the
original record and creating it afresh?

Any assistance will be appreciated. Thanks in advance.

Kiti Chigiri
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20111026/a81522ae/attachment.html>


More information about the postgis-users mailing list