Shows the usage of the method "simplify" that implements the Douglas-Peucker algorithm to remove "insignificant" vertices from LineString geometries.
Instances of OpenLayers.Geometry.LineString have a method simplify, that can be used to simplify linestring geometries. Simplification sometimes is useful to enhance the perfomance of vector rendering or to reduce complexity of geometries. This might be especially handy when viewing geometries a small scales.
OpenLayers.Geometry.LineString::simplify is a recursive implementation of the famous Douglas-Peucker algorithm. It is controlled by a tolerance factor that defines the threshold for vertices to be considered "insignificant" for the general structure of the geometry.
The LineString on the left map can be simplified according to the tolerance value one enters in the form-field above the maps. Use a value between 0 and 1 for best results. If you navigate the left map, the right map will show the same location to make it easier to spot the differeces between the LineStrings.
You can also use the button "Start animation" to get results for increasing tolerance-factors from 0.02 to 1.0. The animation can be paused by clicking on the button "Stop animation".
The LineString represents a part of the coastline of this place southeast of Novosibirsk in Russia — found via an example implementation of the algorithm in python.
For a detailled explanation of the algorithm see the Wikipedia article or the original publication: David Douglas & Thomas Peucker, "Algorithms for the reduction of the number of points required to represent a digitized line or its caricature", The Canadian Cartographer 10(2), 112-122 (1973) (DOI: 10.3138/FM57-6770-U75U-7727).
See simplify-linestring.js for the source code of this example.