[postgis-devel] Collapsing behavior for simplify

Nicklas Avén nicklas.aven at jordogskog.no
Sat Apr 4 13:24:30 PDT 2015


Hallo

When adding tests to ST_SimplifyVW (the Visvalingam-Whyatt version of
simplify) I noticed some differences in behavior between ST_Simplify and
ST_SimplifyVW. Since the ST_Simplify behavior somewhat strange I want to
discuss it before I copy that behavior to ST_SimplifyVW.

It is discussied in many tickets, and I haven't taken the time to read
them all. But I think #1698 comes closest to a solution
http://trac.osgeo.org/postgis/ticket/1698


First an inconsistency with ST_Simplify that I don't understand if is
intentional:
in regression test nr 9 it shows that a polygon collapses and returns
nothing:
http://trac.osgeo.org/postgis/browser/trunk/regress/simplify_expected

But if you take the last test, nr 12 and change last parameter to 200 so
it collapses it returns an empty multipolygon.
SELECT '12', ST_astext(ST_Simplify('MULTIPOLYGON(((0 0, 10 0, 10 10, 0
10, 0 0),(5 5, 5 6, 6 6, 8 5, 5 5)),((100 100, 100 130, 130 130, 130
100, 100 100)))', 200));


Then from what i understand in ticket #1698 ST_Simplify is expected not
to remove the entire boundary but instead return something.

In Visvalingam-Whyatt this is the situation right now (which I am quite
happy with):
For linestrings they always return at least start and end point.

Polygons can collapse inner rings. 
Boundaries is never collapsed. THey always return 4 points. That is
start and end point of pointarray (same point) and the two points with
highest effective area. So the result will be a triangle with as big
area as possible (not too thin triangle).

in multipolygons all inner rings can be collapsed but all sub-geometry
boundaries will remain.

Is there any reason to leave that concept?

I guess it have to be explained  in doc as a difference from
ST_Simplify.

The doc now for the new functions is:
http://postgis.net/docs/manual-dev/ST_SetEffectiveArea.html
and
http://postgis.net/docs/manual-dev/ST_SimplifyVW.html


Regards

Nicklas





More information about the postgis-devel mailing list