pylerc
Limited Error Raster Compression
What it is and what it does
pylerc is a Python binding for LERC, an open-source raster compression format designed for rapid encoding and decoding of image tiles with user-controlled maximum compression error. It works with numpy arrays in 2D, 3D, or 4D shapes, supporting any pixel type from byte to double, and allows marking pixels as invalid via masks, noData values, or NaN. The package offers two main APIs: one using numpy masked arrays (encode_ma/decode_ma) and another using separate data and mask arrays (encode_4D/decode_4D), giving flexibility depending on whether all pixels are valid or sparse masking is needed.
Version 4.2.0 introduces stricter size limits for safety: input data is capped at 2 GB per band, compressed output at 2 GB per band, and total blob size at 4 GB across all bands. The package maintains backward compatibility with LERC 3.0 functions, though mixed valid/invalid cases at the same pixel for multi-band data require the newer API. It is actively maintained, supports current Python versions (3.11–3.14), and carries no known security vulnerabilities.
Use it for:
- Compress geospatial satellite or aerial imagery tiles for efficient storage and transmission with bounded error.
- Encode scientific raster data (e.g., elevation models, climate grids) where lossy compression with user-defined error tolerance is acceptable.
- Decode LERC-compressed blobs received from remote APIs or read from disk into numpy arrays for analysis.
- Handle multi-band imagery (e.g., RGB, hyperspectral) with per-band noData values and mixed valid/invalid pixels.
- Benchmark or migrate existing LERC 3.0 workflows to the newer masked-array API for cleaner mask handling.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
pylerc encodes and decodes raster image data using the LERC (Limited Error Raster Compression) format, supporting lossless and lossy compression with user-defined maximum error per pixel.
Yes. pylerc is actively maintained, carries no known vulnerabilities, uses a permissive Apache 2 license, and offers a clean numpy-integrated API for a specialized but well-defined task. Install it if you work with raster imagery and need bounded-error compression; the medium install friction is typical for packages with compiled wheels. Not necessary for general image compression or if your raster format is already standardized in your pipeline.
Install
pylerc on PyPI
pip
pip install pylercuv
uv add pylercpoetry
poetry add pylercInstalling pylerc
Before you install
Active maintenance with a recent release (22 days old). Medium install friction due to platform-specific wheels; numpy is the sole runtime dependency. Supports Python 3.11 through 3.14.
License in practice
Apache 2 permissive license allows commercial and private use with minimal restrictions; suitable for most projects.
Quickstart
import pylerc
import numpy as np
# Encode a masked array with max error of 0.1
data = np.ma.array([[1, 2], [3, 4]], mask=[[False, False], [False, True]])
result, n_bytes, blob = pylerc.encode_ma(data, nDepth=1, maxZErr=0.1, nBytesHint=0)
# Decode back
result, decoded_arr, depth, nodata = pylerc.decode_ma(blob)
Requires Python 3.11 or later; numpy must be installed.
Verify before relying
- Whether the 2 GB per-band input and output limits in version 4.2.0 are sufficient for typical use cases.
- Performance characteristics (encoding/decoding speed, compression ratios) compared to other raster formats.
- Compatibility with existing LERC 3.0 blobs and migration path for legacy data.
Package facts
| License | Apache 2 (permissive) |
| Python support | supports the current Python release (>=3.11) |
| Install friction | medium — platform-specific wheel |
| Runtime dependencies | 1 — numpy |
| Maintenance | actively maintained — 22 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 173,034/month — #10,319 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: pylerc-4.2.0-py3-none-macosx_11_0_universal2.whl; pylerc-4.2.0-py3-none-manylinux_2_28_x86_64.whl; pylerc-4.2.0-py3-none-win_amd64.whl
Tags
More Scientific/Engineering packages
NumPy provides an N-dimensional array object…
permissive · top 100 on PyPI
pandaspandas provides fast, flexible data structures…
permissive · top 100 on PyPI
scipyscipy provides numerical algorithms for…
permissive · top 100 on PyPI
scikit-learnscikit-learn provides a comprehensive Python…
permissive · top 1,000 on PyPI
dilldill extends Python's pickle module to…
permissive · top 1,000 on PyPI
multiprocessMultiprocess is an enhanced fork of Python's…
permissive · top 1,000 on PyPI
numcodecsNumcodecs provides buffer compression and…
permissive · top 5,000 on PyPI
pylzsspylzss decodes and encodes data compressed with…
copyleft · top 15,000 on PyPI
pystac-ext-rasterExtends PySTAC with the Raster Extension…
permissive · top 5,000 on PyPI
lilcomLossily compresses floating-point NumPy arrays…
permissive · top 15,000 on PyPI
rasterioRasterio reads and writes geospatial raster…
permissive · top 5,000 on PyPI
qoiA Python wrapper for the QOI (Quite OK Image)…
permissive · top 15,000 on PyPI
pylibjpegDecodes and encodes JPEG, JPEG-LS, JPEG 2000,…
permissive · top 15,000 on PyPI
pyjpeglsEncodes and decodes image data using the…
permissive · top 15,000 on PyPI
rlpEncodes and decodes data using Recursive Length…
permissive · top 5,000 on PyPI