Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I encountered a problem simplifying set of polygons that are adjacent. If I simplify each polygon separately with the Douglas–Peucker algorithm (which is used by many open source tools), the resulting polygons are usually not adjacent anymore. This problem exists, for example, when simplifying borders of countries/provinces.

Does anyone has a good solution for it, preferably to be done in postgis?

share|improve this question
Can any one explain me in more details as to how can I resolve above issue using C++ concepts? Is it really possible to simplify adjacent polygons of shapefile? Can I use Douglous Peucker Algorithm in this case if yes then how? – user21354 Aug 23 '13 at 11:22
up vote 17 down vote accepted

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.

share|improve this answer

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.

share|improve this answer
Interesting solution, I will give it a try in couple of days. – stachu Aug 4 '10 at 7:55
Excellent solutions, +1 for providing a code approach. – fmark Aug 4 '10 at 8:57
I know this is fairly old, but theres some problems with Pauls solution, see the lower part of my write up here: – user6512 Mar 23 '12 at 3:10

To avoid this problem, you should model your data using topological constraints. does it.

share|improve this answer

You need to tessellate. In the old ARC/INFO theory of creating geometry, two adjacent geometries is created by one polyline and shared this polyline. Therefore when you generalized, it generalized both borders because it referenced the same polyline.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.