Skip to main content

Pure Python implementation of the Ramer-Douglas-Peucker algorithm

Project description

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

Pure Python implementation of the Ramer-Douglas-Peucker algorithm (Ramer 1972; Douglas and Peucker 1973).

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]])

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

rdp-0.6.tar.gz (3.5 kB view details)

Uploaded Source

File details

Details for the file rdp-0.6.tar.gz.

File metadata

  • Download URL: rdp-0.6.tar.gz
  • Upload date:
  • Size: 3.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for rdp-0.6.tar.gz
Algorithm Hash digest
SHA256 786012f9f04242363a75ac11a5e198f91858cbc09c6f2e3f00a73a2fd1c2c460
MD5 0e5de170f1322ef2d9e390a4502b5d0e
BLAKE2b-256 6c4e7ab95aad0a39c5d938014344cc321be6012b4156226d04ab3803b759a35c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page