Skip to content
Python/Numpy implementation of the Ramer-Douglas-Peucker algorithm
Python Makefile
Branch: master
Clone or download

Latest commit

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
bin fix plotting Oct 7, 2016
docs rtd mock Oct 8, 2016
rdp
.travis.yml py.test doesn't like python 3.2 Oct 7, 2016
LICENSE.txt update email address May 20, 2014
MANIFEST.in initial commit Feb 20, 2014
Makefile add makefile Oct 6, 2016
README.rst add RTD links Nov 14, 2016
setup.py fix typo in pldist (thanks @robertlindner in #6) Dec 19, 2016
tests.py update docs/tests Oct 8, 2016

README.rst

Ramer-Douglas-Peucker Algorithm

https://travis-ci.org/fhirschmann/rdp.png?branch=master https://badge.fury.io/py/rdp.png Documentation Status

Python/NumPy implementation of the Ramer-Douglas-Peucker algorithm (Ramer 1972; Douglas and Peucker 1973) for 2D and 3D data.

The Ramer-Douglas-Peucker algorithm is an algorithm for reducing the number of points in a curve that is approximated by a series of points.

Installation

pip install rdp

Usage

Simple pythonic interface:

from rdp import rdp

rdp([[1, 1], [2, 2], [3, 3], [4, 4]])
[[1, 1], [4, 4]]

With epsilon=0.5:

rdp([[1, 1], [1, 1.1], [2, 2]], epsilon=0.5)
[[1.0, 1.0], [2.0, 2.0]]

Numpy interface:

import numpy as np
from rdp import rdp

rdp(np.array([1, 1, 2, 2, 3, 3, 4, 4]).reshape(4, 2))
array([[1, 1],
       [4, 4]])

Links

References

Douglas, David H, and Thomas K Peucker. 1973. “Algorithms for the Reduction of the Number of Points Required to Represent a Digitized Line or Its Caricature.” Cartographica: The International Journal for Geographic Information and Geovisualization 10 (2): 112–122.

Ramer, Urs. 1972. “An Iterative Procedure for the Polygonal Approximation of Plane Curves.” Computer Graphics and Image Processing 1 (3): 244–256.

You can’t perform that action at this time.