Ramer-Douglas-Peucker line simplification: Difference between revisions

no edit summary
No edit summary
No edit summary
Line 126:
7,9
9,9</pre>
 
=={{header|Python}}==
An approach using the shapely library:
 
<lang python>from __future__ import print_function
from shapely.geometry import LineString
 
if __name__=="__main__":
line = LineString([(0,0),(1,0.1),(2,-0.1),(3,5),(4,6),(5,7),(6,8.1),(7,9),(8,9),(9,9)])
print (line.simplify(1.0, preserve_topology=True))</lang>
{{out}}
<pre>LINESTRING (0 0, 2 -0.1, 3 5, 7 9, 9 9)</pre>
 
==References==
Anonymous user