The various simplification functions in PostGIS (e.g. ST_Simplify) uses a tolerance parameter for the maximum allowable deviation of the generalized shape from the original. My question is:

Is there an effective way to generalize a geometry so that in the end the number of vertices in the output does not exceed a given number?

(This is with latest PostGIS 2.5 on PostgreSQL 11)

  • You can compute the needed value by doing a range-bounded iterative evaluation, splitting half the difference between high and low (binary search), but that's going to be computationally expensive. – Vince May 30 '19 at 0:45
  • The algorithm is iterative, so it's possible to rewrite it so it "stops" when the number of items in PointList[] (or whatever) is less than the threshold number. – Mike T May 30 '19 at 1:48

Your Answer

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

Browse other questions tagged or ask your own question.