Fast linestring simplification using RDP or Visvalingam-Whyatt and a Rust binary
Project description
# Simplification
Simplify a LineString using the [Ramer–Douglas–Peucker](https://en.wikipedia.org/wiki/Ramer–Douglas–Peucker_algorithm) or [Visvalingam-Whyatt](https://bost.ocks.org/mike/simplify/) algorithms

## Installation
`pip install simplification`
Please use a recent (>= 8.1.2) version of `pip`.
### Supported Python Versions
- Python 2.7
- Python 3.4
- Python 3.5
- Python 3.6
### Supported Platforms
- Linux (`manylinux1`-compatible)
- OS X
- Windows 32-bit / 64-bit
## Usage
```python
import numpy as np
from simplification.cutil import simplify_coords, simplify_coords_vw
# Using Ramer–Douglas–Peucker
coords = [
[0.0, 0.0],
[5.0, 4.0],
[11.0, 5.5],
[17.3, 3.2],
[27.8, 0.1]
]
# For RDP, Try an epsilon of 1.0 to start with. Other sensible values include 0.01, 0.001
simplified = simplify_coords(coords, 1.0)
# simplified is [[0.0, 0.0], [5.0, 4.0], [11.0, 5.5], [27.8, 0.1]]
# Using Visvalingam-Whyatt
# You can also pass numpy arrays, in which case you'll get numpy arrays back
coords_vw = np.array([
[5.0, 2.0],
[3.0, 8.0],
[6.0, 20.0],
[7.0, 25.0],
[10.0, 10.0]
])
simplified_vw = simplify_coords_vw(coords, 30.0)
# simplified_vw is [[5.0, 2.0], [7.0, 25.0], [10.0, 10.0]]
```
Passing empty and/or 1-element lists will return them unaltered.
## But I Want to Simplify Polylines
No problem; [Decode them to LineStrings](https://github.com/urschrei/pypolyline) first.
``` python
# pip install pypolyline before you do this
from pypolyline.cutil import decode_polyline
# an iterable of Google-encoded Polylines, so precision is 5. For OSRM &c., it's 6
decoded = (decode_polyline(line, 5) for line in polylines)
simplified = [simplify_coords(line, 1.0) for line in decoded]
```
## How it Works
FFI and a [Rust binary](https://github.com/urschrei/rdp)
## Is It Fast
I should think so.
## License
[MIT](license.txt)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file simplification-0.2.11-cp36-cp36m-win_amd64.whl.
File metadata
- Download URL: simplification-0.2.11-cp36-cp36m-win_amd64.whl
- Upload date:
- Size: 278.0 kB
- Tags: CPython 3.6m, Windows x86-64
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2390a3078fe80d956f1de0020a18343e5582c541c2648307d850be23f78ed236
|
|
| MD5 |
d4d29656045c51a12a33d116af9feae3
|
|
| BLAKE2b-256 |
9083924de8283c806ae3efe745f431281d23e5369737eb1ed11da2f138f9a21f
|
File details
Details for the file simplification-0.2.11-cp36-cp36m-win32.whl.
File metadata
- Download URL: simplification-0.2.11-cp36-cp36m-win32.whl
- Upload date:
- Size: 256.3 kB
- Tags: CPython 3.6m, Windows x86
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a97110b0a45c9a348794bc6e8ffa5d998cbe583a3b4d7ef1762e1db2cb4472a1
|
|
| MD5 |
f30b9ffc78973eab76e28854bb553e42
|
|
| BLAKE2b-256 |
8eab8ab09610c4351f9afbdaeca83728d05512192c4df7403918dce2c3190e7e
|
File details
Details for the file simplification-0.2.11-cp36-cp36m-manylinux1_x86_64.whl.
File metadata
- Download URL: simplification-0.2.11-cp36-cp36m-manylinux1_x86_64.whl
- Upload date:
- Size: 462.2 kB
- Tags: CPython 3.6m
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bfb6a670e199f9f33348ee55f4af5f37fe917543c83eb58a5fb10da7e7691571
|
|
| MD5 |
cecaf4a951d10fffed2f9d97edb26507
|
|
| BLAKE2b-256 |
8adce143d12d63c58a10f9f77e577eec8aa589dde21800ba515381c56dbb7297
|
File details
Details for the file simplification-0.2.11-cp36-cp36m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.macosx_10_11_intel.macosx_10_11_x86_64.whl.
File metadata
- Download URL: simplification-0.2.11-cp36-cp36m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.macosx_10_11_intel.macosx_10_11_x86_64.whl
- Upload date:
- Size: 291.8 kB
- Tags: CPython 3.6m, macOS 10.10+ Intel (x86-64, i386), macOS 10.10+ x86-64, macOS 10.11+ Intel (x86-64, i386), macOS 10.11+ x86-64, macOS 10.6+ Intel (x86-64, i386), macOS 10.9+ Intel (x86-64, i386), macOS 10.9+ x86-64
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4d4525853fc5fb5885faf33f97be8435e50762cbc4a3b516a84601ea2696ae2c
|
|
| MD5 |
cf9277973b5f66b522481271e96c4575
|
|
| BLAKE2b-256 |
398b8f13920090c6bd8a7473ff2dcf3343cf8797b42f4c62cf4c0b61727a0c0b
|
File details
Details for the file simplification-0.2.11-cp35-cp35m-win_amd64.whl.
File metadata
- Download URL: simplification-0.2.11-cp35-cp35m-win_amd64.whl
- Upload date:
- Size: 277.3 kB
- Tags: CPython 3.5m, Windows x86-64
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a4edac8a25d14b6f76783546d988d87841eff4c68d022d47336a51ef2f4ecaa8
|
|
| MD5 |
b3f0060ee59e9818e6af8879af5e1ded
|
|
| BLAKE2b-256 |
2529ad4495e7038fa1d808df3aba781f55ecfa501eca87e2ec16086f49c60f77
|
File details
Details for the file simplification-0.2.11-cp35-cp35m-win32.whl.
File metadata
- Download URL: simplification-0.2.11-cp35-cp35m-win32.whl
- Upload date:
- Size: 255.9 kB
- Tags: CPython 3.5m, Windows x86
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6fe063cfcce7c149f2e88bf3d6b2cd7725f63361713c74b574a0ef9a7aba69ce
|
|
| MD5 |
a8e08ee7d7da00c99dbf7f0ae173f408
|
|
| BLAKE2b-256 |
7685b1e3e950376ad8cfda9ee04ea52d96e141256a80967212c881b970de7d1f
|
File details
Details for the file simplification-0.2.11-cp34-cp34m-win_amd64.whl.
File metadata
- Download URL: simplification-0.2.11-cp34-cp34m-win_amd64.whl
- Upload date:
- Size: 275.5 kB
- Tags: CPython 3.4m, Windows x86-64
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5855decc02515e57249069389a90cb18f72ccdfe989850b1839df86ea4c7df2a
|
|
| MD5 |
16988011e8d3d3a93de493c7f34f2747
|
|
| BLAKE2b-256 |
698e6cca2e39c37b81feb78bf432cab3cf35e67515956957869a1eba4a379046
|
File details
Details for the file simplification-0.2.11-cp34-cp34m-win32.whl.
File metadata
- Download URL: simplification-0.2.11-cp34-cp34m-win32.whl
- Upload date:
- Size: 257.3 kB
- Tags: CPython 3.4m, Windows x86
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8d123ae7ecccbfaab4441c1fea267e3726682d2010cf1fed66b394da5389581d
|
|
| MD5 |
8f8f7cb83f7b7dd13595a400fb70bf5f
|
|
| BLAKE2b-256 |
c2facbe9742b6ddf4ee722559c4eace2e252f8c396bdfdbc690413d07c86e96e
|
File details
Details for the file simplification-0.2.11-cp34-cp34m-manylinux1_x86_64.whl.
File metadata
- Download URL: simplification-0.2.11-cp34-cp34m-manylinux1_x86_64.whl
- Upload date:
- Size: 463.4 kB
- Tags: CPython 3.4m
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
899ca6df8ca01ad26fd143b4a5d76fcf59746a6e116b63f6fbde095cfa30da0d
|
|
| MD5 |
cb188eed693c437652f4c19bc4fd3a4b
|
|
| BLAKE2b-256 |
be5d0a4158cadc6cb24ded59a0479e740a8b91392708f75194597353974c8e24
|
File details
Details for the file simplification-0.2.11-cp27-cp27mu-manylinux1_x86_64.whl.
File metadata
- Download URL: simplification-0.2.11-cp27-cp27mu-manylinux1_x86_64.whl
- Upload date:
- Size: 440.6 kB
- Tags: CPython 2.7mu
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
40497f40132eb64835e9763f04c05d8f8748def04967b114484dfa2f13ce0591
|
|
| MD5 |
2594954441071966ccf6572442dd2e70
|
|
| BLAKE2b-256 |
7d9e4199076707ff9b610d56061f74c2a43aa6c6dfb1ca915160728bae082d2f
|
File details
Details for the file simplification-0.2.11-cp27-cp27m-win_amd64.whl.
File metadata
- Download URL: simplification-0.2.11-cp27-cp27m-win_amd64.whl
- Upload date:
- Size: 277.1 kB
- Tags: CPython 2.7m, Windows x86-64
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
90770fe6295462e25dcd31022e5b042f7d060f1ce2954d399651b6cda335115f
|
|
| MD5 |
823dcd70f04ff34257288ebae833416b
|
|
| BLAKE2b-256 |
963768cc0802a1a4698dfe71eac5aaa199afb7595a9224ed350bc330314bef46
|
File details
Details for the file simplification-0.2.11-cp27-cp27m-win32.whl.
File metadata
- Download URL: simplification-0.2.11-cp27-cp27m-win32.whl
- Upload date:
- Size: 256.8 kB
- Tags: CPython 2.7m, Windows x86
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6777e1ccec61fb5c5a4e590da5e48b9dc18ff167b630d0c4d7a7da1cea7db826
|
|
| MD5 |
d3ab5c5efbd2e647f6279988ef297233
|
|
| BLAKE2b-256 |
4f9de3abd80d07214a9c166c82d72843f0c027ae73edcdff93d1c1bd9630f34c
|
File details
Details for the file simplification-0.2.11-cp27-cp27m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.macosx_10_11_intel.macosx_10_11_x86_64.whl.
File metadata
- Download URL: simplification-0.2.11-cp27-cp27m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.macosx_10_11_intel.macosx_10_11_x86_64.whl
- Upload date:
- Size: 321.3 kB
- Tags: CPython 2.7m, macOS 10.10+ Intel (x86-64, i386), macOS 10.10+ x86-64, macOS 10.11+ Intel (x86-64, i386), macOS 10.11+ x86-64, macOS 10.6+ Intel (x86-64, i386), macOS 10.9+ Intel (x86-64, i386), macOS 10.9+ x86-64
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9fc18fa858513c4ad1086cbd6ba64dae6fa1cfd3410f44888ded1da6b8eb677b
|
|
| MD5 |
86d240baa4c794d08bf359774a0cf733
|
|
| BLAKE2b-256 |
9eb0b50a18f9e006d667d601358aa7095b70fd629c62584f8b28bfaca929635a
|