2

I have a column named position with geo data. Query:

SELECT ST_SRID(position) FROM checkpoint LIMIT 1;

returns 4326

If I try to simplify/compress points with

SELECT st_dumppoints(st_simplify(st_makeline(points.position)), 0.005))).geom
FROM 
    (SELECT position
    FROM checkpoint) AS points

it works, but my question is, is st_simplify SRID aware function? Or should I transform the points to another coordinate system with ST_Transform? (The function probably reduces the number of nodes based on line section angles and the simplification may not give the correct results if it does not acknowledge lat lon coordinates - lat : lon ratio is not 1, which is the case with x and y from Cartesian coordinate system).

1

The ST_Simplify uses the Ramer–Douglas–Peucker algorithm which takes a user-defined tolerance, then iterates over the geometry object and removes points that fall within the algorithm's criteria + the tolerance.

The tolerance is based on your SRID, so if your geometry is in 4326 then the tolerance is in decimal degrees. However, the algorithm doesn't change based on whether your geometry is projected X/Ys or geographic lat/longs. With that said, I'm having a hard time coming up with a case where the algorithm doesn't work as expected... perhaps if you're using a global tolerance but run across data in extreme latitudes? You may need to check latitude values and pass in more stringent tolerances if you data is not coming out as expected.

  • Results are satisfying, my concerns were that scaling on one axis does not preserve distances between points and that results would be distorted because that algorithm simplifies polylines based on distances. It turns out that it works well despite possible unawarness of coordinate system. – gmap Sep 3 '15 at 12:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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