It is expected that a "geometry simplification" is a good practice to preserve stable versions of a geometry, avoiding minor and non-relevant changes (side effect of geometry-editors and other "false updates").

The functions ST_Simplify, ST_SimplifyPreserveTopology or ST_SimplifyVW seems good candidates. It is important

  • to preserve original geometry when it not needs simplification;
  • to control the "need less simplification" by a parameter, like tolerance.

So, the hypothesis is that we can check sensibility by changing a tolerance parameter.

... But it is not working, so the question is "How to check sensibility?" in that context.

I am testing ST_Simplify(geom,0.00001)=geom and is false.. But even ST_AsGeoJSON(geom,3)=ST_AsGeoJSON(ST_Simplify(geom,0.00000001),3) is false!!


 origianal  = ... [-60.931,2.64],[-60.929,2.638],[-60.925,2.635],[-60.919,2.63],[-60.917,2.628],...

 simplified = ... [-60.931,2.64],[-60.925,2.635],[-60.919,2.63],[-60.917,2.628],...

Usage context

I need to preserve stable versions into a git repository of GeoJSON files.

PS: if a "non-invasive simplification algorithm" not exists (?), them, a workaround, a simple way to normalize geometry for git stable versions is to apply something as ST_buffer(ST_buffer(geom,0.000001),-0.000001).

  • 1
    Using the original sample you give, the simplified output contains all source points. Also don't forget that if 1 point was removed, the equality between the source and the simplified geometry will be false.
    – JGH
    Feb 12, 2020 at 18:56
  • Thanks @JGH, you show the correct direction for a good answer... I need to test other operators tham =, maybe ST_Contains or even ST_Equals (as guide say " a 'better' answer than =")... If all the removed points lie on the same original geometry, the st_simplify() is preserving geometry (!). Feb 12, 2020 at 20:15

1 Answer 1


The @JGH comment showed the way to solve the problem. It is possible to compare original geometry g with the simplified one by ST_Equals:

SELECT ST_equals(g, ST_SimplifyVW(g,0.000000000001) ) eq  FROM t; -- false...
SELECT ST_equals(g, ST_SimplifyVW(g,0.0000000000001) ) eq FROM t; -- true!

Checking all possibilities:

WITH calc AS (
  SELECT tol, g, 
         ST_Simplify(g,tol) s, ST_SimplifyPreserveTopology(g,tol) stp,
         ST_SimplifyVW(g,tol) svw  
  FROM t, (VALUES (0.01),(0.0000000000051),(0.000000000001),(0.0000000000001)) v(tol)
) SELECT tol tolerance, (g=s) eqq_s, 
         ST_equals(g,s) eq_s, ST_equals(g,stp) eq_stp, ST_equals(g,svw) eq_svw,
         ST_contains(g,s) ct_s, ST_contains(g,stp) ct_stp, ST_contains(g,svw) ct_svw
  FROM calc;


    tolerance    | eqq_s | eq_s | eq_stp | eq_svw | ct_s | ct_stp | ct_svw
            0.01 | f     | f    | f      | f      | f    | f      | f
 0.0000000000051 | f     | t    | t      | f      | t    | t      | f
  0.000000000001 | f     | t    | t      | f      | t    | t      | f
 0.0000000000001 | f     | t    | t      | t      | t    | t      | t


  • The best seems to use st_equals() and ST_SimplifyPreserveTopology(g,t), for near-zero tolerance.

  • The = is not valid for simplification, use st_equals or st_contains to compare original and simplified geometries.

  • Simplification algorithm ST_SimplifyVW is the worst. The ST_Simplify is good and good tham ST_SimplifyPreserveTopology, but to preserve topology is a goood practice in this context.

  • interesting comparison, thanks! The conclusion for st_contains should be reconsidered because is relies on the location of the removed vertices (result will be true if removed vertex is inside the source polygon, but will be false if it was outside of the polygon)
    – JGH
    Feb 13, 2020 at 12:25
  • Hi @JGH, your comment makes sense, maybe we should to test the sensitivity against some kind of st_buffer operation to extract a "polygon-border of width w", where w is the tolerance. By other hand, comparison of "similar things" relies on a specific concept of similarity... It is not absolute, it is relative to the user's view, a user concept of similarity. When a user is looking for preserving-area operations, the st_contains make sense. PS: in the perspective of my answer, where my choice was st_equals, the contains discussion is about a secondary use case. Feb 15, 2020 at 10:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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