7

We have geometries in a PostGIS database projected in srid 4326. We need to have these geometries simplified with ST_SimplifyPreserveTopology.

My question is whether this geometry needs to be transformed to a different projection--like 3400 in Alberta, Canada--to simplify it accurately by meters instead of degrees: if simplified by degrees, would it remove points more frequently on the parts of the geometry farther from the equator (because of the way degrees bend around the earth)?

Or would the function remove points in the same frequency and locations no matter the projection, if given the same region as a test?

6
  • 3
    As the Douglas Peucker algorithm works by removing those points that are within a given tolerance in some given input unit, you can assume that if you have a geometry covering a large north-south distance, you will get greater amounts of simplification for a given tolerance in degrees as you move further south. I believe that this will scale with the secant approximately, as with the scale factor in a Mercator projection, as essentially if you use degrees in this way, the algorithm is behaving as though the input is projected. Jul 22, 2015 at 2:42
  • 1
    as the distances used to calculate tolerance of a point from a line between two other points will be Euclidean. So, yes, you would be better off using a projected coordinate system. I don't know much about the 3400 projection, but something like the UK's projection, 27700, which is Transverse Mercator, and therefore has constant scale in the North-South direction, and increasing (but small) distortion either side of the central meridian of the projection would be ideal. I have used ST_Simplify in both forms with 4326 over small areas, with good results, so it really depends on your NS extents. Jul 22, 2015 at 2:46
  • 1
    I just looked up 3400 and it is Transverse Mercator, spatialreference.org/ref/epsg/3400, so you are good to go with a ST_SimplifyPreserveTopology(ST_Transform(geom, 3400), tolerance); Perhaps I should make this an answer and try and explain myself a bit better, which is hard to do in comments :-) Jul 22, 2015 at 3:06
  • @JohnBarça So transforming to a Transverse Mercator would provide a more uniform simplification of the geometry than not transforming?
    – bozdoz
    Jul 22, 2015 at 15:46
  • 1
    Yes. There would be minor differences, but none in north-south direction, and an even, if increasing (but small) amount, in east-west direction around central meridian of the TM projection. Jul 22, 2015 at 16:14

1 Answer 1

5

As the Douglas Peucker algorithm works by iteratively removing those points that are within a given tolerance from some line between two other points in some given input unit, you can assume that if you have a geometry covering a large north-south distance, you will get greater amounts of simplification for a given tolerance in degrees as you move further south. I believe that this will scale with the secant approximately, as with the scale factor in a Mercator projection, as essentially if you use degrees in this way, the algorithm is behaving as though the input is projected as the distances used to calculate tolerance of a point from a line between two other points will be Euclidean.

So, yes, you would be better off using a projected coordinate system. I don't know much about the 3400 projection, but I have worked with the UK's 27700, which is also Transverse Mercator, and therefore has constant scale in the North-South direction, and increasing (but small) distortion either side of the central meridian of the projection would be ideal -- so ideal for ST_Simplify.

Something like:

SELECT ST_SimplifyPreserveTopology(ST_Transform(geom, 3400), tolerance) 
FROM sometable;

should work.

Ultimately, you can always test the difference using measures like ST_Area or ST_Npoints one with 4326 and one with 3400 to get a feel for the differences.

As an aside, there is an alternative simplification algorithm you might be interested in, called visvalingam-whyatt that might be of interest of you are doing a lot of work in simplification. The above links to source code form Mike Bostock the creator of D3.js. Also so mapshaper for a working example.

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.