Simplifying adjacent polygons using PostGIS?

A topological vector model will provide what you need. In a non-topological storage (such as a shapefile), a single edge between geometries is stored twice. In a topological vector, the areas are stored separately from the lines, so adjustments can be made without effecting topology. I couldn't find a good diagram, so I created this simple example, where the areas A, B and C are computed from the intersections of the lines (connecting 1-4) which separate them. example of a topological vector

This model is used by ArcInfo as coverages, in GRASS as its default vector model, and can be used in PostGIS with the experimental PostGIS Topology tool. Perhaps a simpler solution is converting your data into linework, removing the redundant segements, and then recreating your polygons after simplification.


You want to turn your polygons into lines, make those lines be simple coverage edges, simplify those edges, then build them back up into polygons again, and finally use point-in-polygon to re-join the attributes of the old polygons with the new ones.

CREATE TABLE rings AS SELECT (ST_DumpRings(polys)).geom AS rings FROM polytable;
CREATE TABLE simplerings AS SELECT ST_Union(rings) AS simplerings FROM rings;
CREATE TABLE newpolycollection AS SELECT ST_Polygonize(ST_Simplify(simplerings, 10.0)) AS geom FROM simplerings;
CREATE TABLE newpolysnoattributes AS SELECT (ST_Dump(geom)).geom FROM newpolycollection;
CREATE TABLE newpolytable AS SELECT new.geom, old.attr FROM newpolysnoattributes new, polytable old WHERE ST_Contains(new.geom, ST_PointOnSurface(old.polys));

There are errors in the above, but the core concept is there. You can do it all in one query if you like.


To avoid this problem, you should model your data using topological constraints. http://mapshaper.org/ does it.