I have a table with a few invalid geometries (empty rings, self-intersections). I'd like to fix them up something like this:
update mytable
set geomcolumn = st_makevalid(geomcolumn)
where id = 123;
and I get "ERROR: Geometry type (GeometryCollection) does not match column type (MultiPolygon)"
is there some other function I need to wrap the st_makevalid() in to get a compatible type, or something else?
select id, st_multi(st_collectionextract(st_makevalid(geomcol), 3)) from mylayer where id in (123, 456);
update mylayer set geomcol = st_multi(st_collectionextract(st_makevalid(geomcol), 3)) where id in (123, 456);
– MC5 Oct 03 '15 at 15:58