= An example showing how to simplify a multipolygon layer, keeping topology between objects = == What we want == Simplifying this layer [[Image(SPT_dept_ori.png)]] into this: [[image:SPT_dept_sim.png]] == The data == French administrative subdivisions, called "départements", will be used. Data can be downloaded here: [http://http://professionnels.ign.fr/DISPLAY/000/528/175/5281750/GEOFLADept_FR_Corse_AV_L93.zip] Data projection is Lambert-93, EPSG:2154 == Loading the data == {{{ shp2pgsql -IiD -g geom -s 2154 DEPARTEMENT.SHP departement | psql }}} == Principle of simplification == Based on the technique described here [[]], we extract linestrings out of polygons, then union and simplify them. st_polygonize() is used to rebuild surfaces from linestrings. Attributes from the initial layer are associated with simplified polygons. == Steps == 1. First extract the input multipolygons into polygons, keeping their departement code. This will allow us to associate attributes to each part of multipolygons at the end of the process. {{{ create table dep_poly as select gid, code, st_dump }}}