[postgis-users] simplifying (homogenize) a polygon

Denis Rouzaud denis.rouzaud at gmail.com
Wed Nov 20 08:36:20 PST 2013


Hi all,

I am drawing some multipolygons in QGIS and sometimes, I have parts of 
them which are adjacent and I'd like to homogenize them to have less 
parts and no adjacent parts.

I could do this with a quite complex method:

1. get the number of parts Z:
SELECT ST_NumGeometries(geometry) FROMmytable WHERE id=123;

2. do the simplification using ST_CollectionHomogenize:
SELECT 
ST_Multi(ST_CollectionHomogenize(ST_Union(ST_GeometryN(geometry,n)))) 
FROM mytable CROSS JOIN generate_series(1,Z) n WHERE id = 123;

3. update manually the result in the table (copy paste).


Does someone has something more straightforward???

Thanks a lot!

Best regards,

Denis


More information about the postgis-users mailing list