polyline.simplify[opt])

Simplify the polyline by removing non-essential points (i.e. points lying along straight lines within the polyline).

This function modifies the original polyline and returns self. If the polyline has fewer than 3 points, the polyline is not modified.

By default, a point is considered non-essential only if it lies directly on the connection line between the previous and the following point. You can specify a tolerance range by providing a threshold value within the opt object. Polyline points that are closer to the connection line than this value (inclusive) are removed; points that are farther from the connection line (exclusive) are kept.