[!IMPORTANT]
xarray-spatial uses AI assistance. Before opening a PR, read the AI-Assisted Contribution Policy and run your changes through the project's approved AI review workflow (see the command suite in the xarray-spatial-skills repo). PRs that ignore the workflow are likely to be rejected.
Feature freeze in effect. The project is working toward its first major release (1.0.0). Until 1.0.0 ships, only bug fixes, test coverage, performance work, and documentation PRs will be considered. New feature proposals will be triaged but not implemented until after the release.
Contributors Wanted!. xarray-spatial is currently looking for contributors to help run pre-defined AI-assisted workflows as we approach v1.0.0. If you are interested, please add an issue and flag @brendancol and we can chat.
| Latest Release |
|
Downloads |
|
| License |
|
People |
|
| Build Status |
|
Coverage |
|

:round_pushpin: Fast, Accurate Python library for Raster Operations
:zap: Extensible with Numba
:fast_forward: Scalable with Dask
:desktop_computer: GPU-accelerated with CuPy and Numba CUDA
:confetti_ball: Free of GDAL / GEOS Dependencies
:earth_africa: General-Purpose Spatial Processing, Geared Towards GIS Professionals
Xarray-Spatial is a Python library for raster analysis built on xarray. It has 150+ functions for surface analysis, hydrology (D8, D-infinity, MFD), fire behavior, flood modeling, multispectral indices, proximity, classification, pathfinding, and interpolation. Functions dispatch automatically across four backends (NumPy, Dask, CuPy, Dask+CuPy). A built-in GeoTIFF/COG reader and writer handles raster I/O without GDAL.
Installation
# via pip
pip install xarray-spatial
# with plotting helpers (matplotlib)
pip install xarray-spatial[plot]
# with vector rasterization (shapely): rasterize, polygonize
pip install xarray-spatial[vector]
# via conda
conda install -c conda-forge xarray-spatial
Downloading our starter examples and data
Once you have xarray-spatial installed in your environment, you can use one of the following in your terminal (with the environment active) to download our examples and/or sample data into your local directory.
xrspatial examples : Download the examples notebooks and the data used.
xrspatial copy-examples : Download the examples notebooks but not the data. Note: you won't be able to run many of the examples.
xrspatial fetch-data : Download just the data and not the notebooks.
In all the above, the command will download and store the files into your current directory inside a folder named 'xrspatial-examples'.
xarray-spatial grew out of the Datashader project, which provides fast rasterization of vector data (points, lines, polygons, meshes, and rasters) for use with xarray-spatial.
xarray-spatial does not depend on GDAL or GEOS. Raster I/O, reprojection, compression codecs, and coordinate handling are all pure Python and Numba -- no C/C++ bindings anywhere in the stack.
API reference docs and 33+ user guide notebooks cover every module.
Raster-huh?
Rasters are regularly gridded datasets like GeoTIFFs, JPGs, and PNGs.
In the GIS world, rasters are used for representing continuous phenomena (e.g. elevation, rainfall, distance), either directly as numerical values, or as RGB images created for humans to view. Rasters typically have two spatial dimensions, but may have any number of other dimensions (time, type of measurement, etc.)
Supported Spatial Functions with Supported Inputs
Each cell shows the feature tier for that function on that backend (see issue #2415). A blank cell means no implementation on that backend; a path that was previously documented as a CPU fallback is reported here as advanced (it works as a documented execution mode, but is not native-parity tested).
✅ stable · 🔼 advanced · 🧪 experimental · 🔧 internal · 🚫 unsupported
GeoTIFF / COG I/O · Classification · Diffusion · Focal · Morphological · Fire · Multispectral · Multivariate · MCDA · Pathfinding · Proximity · Reproject / Merge · Raster / Vector Conversion · Surface · Hydrology · Flood · Interpolation · Dasymetric · Zonal · Templates · Utilities
GeoTIFF / COG I/O
Native GeoTIFF and Cloud Optimized GeoTIFF reader/writer. No GDAL required.
VRT is supported as a conservative advanced feature for simple GeoTIFF mosaics, not as a full GDAL VRT replacement. See the VRT support matrix for the supported subset and what is out of scope.
| Name |
Description |
NumPy |
Dask |
CuPy GPU |
Dask+CuPy GPU |
Cloud |