[postgis-users] Calculate z value based on attribute field

Sandro Santilli strk at keybit.net
Thu Apr 21 08:51:18 PDT 2011


On Thu, Apr 21, 2011 at 07:32:51PM +0400, Gis Mage wrote:
> Hello again!
> 
> Doing as proposed I get an error.
> 
> wizbase=# select
> addgeometrycolumn('public','allhousefinal','the_geom3d',4326,'MULTIPOLYGON',3);
>                           addgeometrycolumn
> ---------------------------------------------------------------------
>  public.allhousefinal.the_geom3d SRID:4326 TYPE:MULTIPOLYGON DIMS:3
> (1 row)
> 
> wizbase=# update allhousefinal set the_geom3d = st_union(the_geom,
> st_setsrid(st_makepoint(st_x(st_pointonsurface(the_geom)),st_y(st_pointonsurface(the_geom)),
> result_hig*3),st_srid(the_geom)));
> ERROR:  new row for relation "allhousefinal" violates check constraint
> "enforce_geotype_the_geom3d"
> 
> As you can see the geometry type is MULTIPOLYGON, so I think the problem is
> somewhere around st_makepoint.
> Can you please help me out?

Wrap in an ST_multi() the st_union() call.

--strk;

  ()   Free GIS & Flash consultant/developer
  /\   http://strk.keybit.net/services.html



More information about the postgis-users mailing list