mapcv
Turn imagery and labels into ready-to-train remote-sensing datasets, fast.
Patches and building masks made by mapcv. Imagery: Beeldmateriaal Nederland (CC BY 4.0); labels: © OpenStreetMap contributors.
Statement of Need
Building a machine-learning dataset from geospatial data usually means a one-off script: fetch or read imagery, burn label polygons, cut patches, split. Done carefully, it handles coordinate systems, pixel-centre rules, NoData, memory, crashes and spatial leakage between train and test; done quickly, it silently gets them wrong. Existing geospatial tools are analysis-first or sample data at training time. mapcv is data-creation-first: one YAML config, and the result is plain files on disk, checked against reference implementations.
- Imagery: XYZ tiles, your own GeoTIFF/COG (local,
https://, s3://), Sentinel-2 (EOPF Zarr, or COGs found in a STAC catalog, with cloud masking), Google Earth Engine; several sources on one grid.
- Labels: GeoJSON, KML, GeoPackage, Shapefile, GeoParquet, OpenStreetMap, or a label raster.
- Tasks: semantic segmentation, object detection (COCO/YOLO), instance segmentation (COCO RLE), patch classification, change detection and regression.
- Output: PNG/JPEG/GeoTIFF/NPY patches, a manifest, leakage-safe splits, and exports to Hugging Face Parquet, WebDataset, Zarr and TerraTorch;
mapcv.data.MapcvDataset loads any of them for PyTorch.
- Correct and fast: masks follow GDAL's exact rules; a careful rasterio script, GDAL's tools and leafmap produce the same patches, 1.5–34× more slowly (benchmarks). Interrupted runs resume byte for byte; memory stays bounded on any region size.
Why not a script, TorchGeo, Raster Vision or geoai? See Why mapcv.
Installation
pip install mapcv
Requires Python 3.10 or newer. One pre-built wheel per platform (Linux x86-64 and aarch64 with glibc or musl, macOS, Windows) covers every supported Python version; other platforms build from source and need a Rust toolchain.
Optional extras: mapcv[zarr] (Sentinel-2 EOPF Zarr, Python 3.10–3.13), mapcv[gee] (Google Earth Engine), mapcv[parquet] (GeoParquet labels), mapcv[export] (every export format: Hugging Face Parquet, Zarr) and mapcv[mcp] (the MCP server for AI agents). XYZ tiles, GeoTIFF/COG and STAC need none of them.
Quick start
1. Scaffold a config file
mapcv init my_dataset.yaml