[postgis-users] problems with UPDATE
Brian Modra
epailty at googlemail.com
Fri Dec 4 04:51:11 PST 2009
009/12/4 Daniel Grum <daniel.grum at unibw.de>:
> Hi
>
> I want to update a geometry table with polygon geometries:
>
> UPDATE wald_by
> SET the_geom =
> ST_BuildArea(ST_Collect(ST_Intersection(poly.the_geom,ST_Expand(pt.the_geom,
> 2000)),poly.the_geom))
> FROM public.wald_by poly, public.holzfaeller pt, public.runden i
> WHERE poly.the_geom && ST_Expand(pt.the_geom, 2000) AND pt.style=2 AND
> i%10=0;
>
> Every 10th round this Update will be startet and only for this that have the
> style=2 -->lumberjacks that clear wood and not work regenerative like
> style=1.
>
> Info to the attributes of the table:
> gid serial NOT NULL, id integer, the_geom geometry, flaeche double
> precision, flaeche_ges double precision,
> CONSTRAINT wald_by_pkey PRIMARY KEY (gid),
> CONSTRAINT enforce_dims_the_geom CHECK (ndims(the_geom) = 2),
> CONSTRAINT enforce_geotype_the_geom CHECK (geometrytype(the_geom) =
> 'MULTIPOLYGON'::text OR the_geom IS NULL),
> CONSTRAINT enforce_srid_the_geom CHECK (srid(the_geom) = 31467)
>
> The Update don't works because:
> ERROR: new line for relation »wald_by« breaches Check-Constraint
> »enforce_geotype_the_geom«
>
> So I thing the new geometry is no MULTIPOLYGON???!!!
The return type can be a Polygon or MultiPolygon, depending on input
> Are there any ideas?
ST_Multi(ST_BuildArea(ST_Collect(ST_Intersection(poly.the_geom,ST_Expand(pt.the_geom,2000)),poly.the_geom)))
>
> --daniel
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
>
--
Brian Modra Land line: +27 23 5411 462
Mobile: +27 79 69 77 082
5 Jan Louw Str, Prince Albert, 6930
Postal: P.O. Box 2, Prince Albert 6930
South Africa
http://www.zwartberg.com/
More information about the postgis-users
mailing list