Version 1 (modified by 13 years ago) ( diff ) | ,
---|
An example showing how to simplify a multipolygon layer, keeping topology between objects
What we want
Simplifying this layer 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
- 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
Attachments (9)
-
SPT_dept_ori.png
(50.2 KB
) - added by 13 years ago.
Departement, originals
-
SPT_bad_attributes.png
(55.3 KB
) - added by 13 years ago.
simplified departements, bad attribute association
-
SPT_dept_sim.png
(45.6 KB
) - added by 13 years ago.
Final result
-
SPT_good_attributes.png
(55.2 KB
) - added by 13 years ago.
simplified departements, correct attribute association
-
SPT_islands_removed.png
(59.3 KB
) - added by 13 years ago.
simplified departements, zoom on simplified islands
-
SPT_simple_dept.png
(56.5 KB
) - added by 13 years ago.
simplified departements, with attributes
-
SPT_no_topo.png
(80.5 KB
) - added by 13 years ago.
simplified departements with broken topology
- world_before.png (72.0 KB ) - added by 13 years ago.
- world_after.png (67.4 KB ) - added by 13 years ago.
Download all attachments as: .zip
Note:
See TracWiki
for help on using the wiki.