Skip to main content

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

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.7.tar.gz (4.4 kB view details)

Uploaded Source

Built Distribution

rdp-0.7-py2-none-any.whl (5.5 kB view details)

Uploaded Python 2

File details

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

File metadata

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

File hashes

Hashes for rdp-0.7.tar.gz
Algorithm Hash digest
SHA256 13993dba5ea2f6cda73019f205f2ce9584cd4bb3de3493fe929c9eed0184123a
MD5 2e23f79136966e8919d8c99647d3e4ae
BLAKE2b-256 8e94714899460a64e9f3c9b3bc567a2fc5292814ace1036ba2b9897d90e33b0e

See more details on using hashes here.

File details

Details for the file rdp-0.7-py2-none-any.whl.

File metadata

  • Download URL: rdp-0.7-py2-none-any.whl
  • Upload date:
  • Size: 5.5 kB
  • Tags: Python 2
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for rdp-0.7-py2-none-any.whl
Algorithm Hash digest
SHA256 c98c27b29b63fea082b72fb3df5758c046e502430fc97a8a5db5823e9187d48e
MD5 01393cc0718ac7d3f4f9d68fec91f757
BLAKE2b-256 1144ec7afc66f66ab1e98fa788aeac82f048a08d879bf9eff44937d6ef2c1510

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