Remove duplicate positions from polylines.

For #898.