TransWikia.com

Simplify geometries but keep them contiguous

Geographic Information Systems Asked by zod on February 27, 2021

I have several detailed contiguous areas. I need to turn each one into KML, but when I do so, the end result is too large (in terms of memory). Using PostGIS I need to simplify these geometries but keep them contiguous.

I have tried calling ST_SimplifyPreserveTopology with a GEOMETRYCOLLECTION created by ST_Collect, but the areas are no longer contiguous.

Previously I think I have succeeded in simplifying areas while at the same time keeping shared borders in line with each other by using desktop applications. However, I am looking for a way to do the same using PostGIS.

3 Answers

I have posted another solution on my blog at www.spheraware.com/blog/post/late-tessellate. This approach is still a work in progress but it has been effective for me. You simplify first and then fix the alignment problems. It's much faster than the "disassemble-simplify-reassemble" recipe and there is no need to create a topology or additional tables.

Answered by Sphera on February 27, 2021

You can simplify your polygons using two ways:

  • Without topology support: just transform polygones to lines, simplify, rebuild the polygons and reattach attributes with Point in Polygon. You will find a first recipe on the PostGIS wiki

  • With topology support. There is another recipe available on the PostGIS wiki. IMO, it's the recommended way.

In both case, for simplifying, you can choose the ST_Simplify and ST_SimplifyPreserveTopology functions based on Douglas-Peucker algorithm or the ST_SimplifyVW function based on the Visvalingam-Whyatt algorithm if you use PostGIS 2.2+.

Answered by ThomasG77 on February 27, 2021

You can use ST_SnapToGrid(geom,0.01) to align all your vertices to a grid with a certain precision (0.01 in the example). There is the risk of losing small geometries or creating complex geometries though, so find out first how much precision your data needs in the first place. Also, it assumes the vertices of adjacent faces are at exactly the same location.

Reference: http://postgis.net/docs/ST_SnapToGrid.html

Answered by tilt on February 27, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP