cog2tiles
Cloud Optimized GeoTIFF (COG) to web map tiles converter built with modern Python.
Installation
Using uv (recommended)
git clone https://github.com/kshitijrajsharma/cog2tiles.git
cd cog2tiles
uv sync
Using pip
pip install cog2tiles
Usage
Command Line Interface
Basic usage:
cog2tiles input.tif -z 19
Advanced usage:
cog2tiles input.tif -z 19 --tile-size 512 --extension png --output-dir tiles/ --workers 64
Options
input_cog: Path to input COG file-z, --zoom: Target zoom level (0-22)-o, --output-dir: Output directory (default: tiles)--tile-size: Tile size in pixels, 256 or 512 (default: 256)--prefix: Filename prefix for tiles (default: tile)--extension: Output format - png, jpg, webp (default: png)--workers: Maximum concurrent workers (default: auto-detected)--log-level: Logging level - DEBUG, INFO, WARNING, ERROR (default: INFO)
Python API
import asyncio
from cog2tiles import COGTiler
async def main():
tiler = COGTiler(
tile_size=512,
max_workers=32,
extension="webp"
)
await tiler.convert_to_tiles("input.tif", "output/", zoom=19)
asyncio.run(main())
Requirements
- Python 3.11 or higher
- GDAL/rasterio for geospatial operations
- Numba for accelerated processing
- UV for dependency management
- uvloop for the fast asyncio loops (optional)
Development
Setup Development Environment
git clone https://github.com/kshitijrajsharma/cog2tiles.git
cd cog2tiles
uv sync --dev
Running Tests
uv run pytest
Code Formatting
uv run black src/
uv run isort src/
Supported Input Formats
- Cloud Optimized GeoTIFF (COG)
- Any rasterio-supported format with proper georeferencing
Output Formats
- PNG (lossless, supports transparency)
- JPEG (lossy, smaller file sizes)
- WebP (modern format, good compression)
License
MIT License - see LICENSE file for details.
Author
Kshitij Raj Sharma (2025)
Metadata
Release files for cog2tiles 0.0.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| cog2tiles-0.0.4.tar.gz | 69.6 kB | Without provenance | Details for cog2tiles-0.0.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| cog2tiles-0.0.4-py3-none-any.whl | Python 3 | none | any | Details for cog2tiles-0.0.4-py3-none-any.whl |
Total release size: 79.8 kB
Release files / cog2tiles-0.0.4.tar.gz
| Download URL | cog2tiles-0.0.4.tar.gz |
|---|---|
| Size | 69.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
60f368ab24451121e073bb3f0218025275e996cb08db0444811708373a1ddd75
|
|
BLAKE2b-256 checksum How to use checksums |
509c3365670df62aac87eadbc6492f477fc84035a14740ce98c61ea99cf24064
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.8.12
|
Release files / cog2tiles-0.0.4-py3-none-any.whl
| Download URL | cog2tiles-0.0.4-py3-none-any.whl |
|---|---|
| Size | 10.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d35591babc59b55165c94469d94d685a0c09c8e26a9306d67d8e2bd10f7993bd
|
|
BLAKE2b-256 checksum How to use checksums |
c06086a44701a489f45072e4b70845d5833a32c8058e1574d6610c7b51cca2f6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.8.12
|
Security for cog2tiles 0.0.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.