xarray-spatial
xarray-based spatial analysis tools
What it is and what it does
xarray-spatial is a Python library for raster analysis built on xarray that handles gridded geospatial data (GeoTIFFs, COGs, and other raster formats) without requiring GDAL or GEOS. It provides a large collection of spatial functions for tasks like elevation analysis, hydrological modeling, fire behavior simulation, and multispectral image processing. The library automatically selects the right computational backend—NumPy for single-machine CPU work, Dask for distributed processing, CuPy for GPU acceleration, or combinations thereof—based on your data and parameters, so you write the same code regardless of scale.
The package includes a native GeoTIFF and Cloud Optimized GeoTIFF reader and writer implemented in pure Python and Numba, eliminating the need for external C/C++ geospatial libraries. It is designed for GIS professionals and researchers who need fast, extensible raster operations. The project is currently in feature freeze leading toward a 1.0.0 release, accepting only bug fixes, performance improvements, and documentation work.
Use it for:
- Read and write GeoTIFF or COG files directly without GDAL, optionally scaling to Dask or GPU backends.
- Compute hydrological flow direction and accumulation using D8, D-infinity, or MFD algorithms on elevation models.
- Generate multispectral vegetation indices from satellite imagery bands.
- Model flood extent and fire behavior by applying focal and morphological operations across raster datasets.
- Perform proximity analysis, pathfinding, and interpolation on gridded spatial data with automatic backend dispatch.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
xarray-spatial provides 150+ functions for raster analysis—surface operations, hydrology, fire behavior, flood modeling, multispectral indices, and pathfinding—that dispatch automatically across NumPy, Dask, CuPy, and Dask+CuPy backends, with native GeoTIFF/COG I/O and no GDAL dependency.
Yes, if you work with raster geospatial data and want to avoid GDAL/GEOS dependencies. The library is actively maintained, has low install friction, and offers a broad toolkit for common GIS operations. The feature freeze may slow new feature adoption, but core functionality is stable. Requires Python 3.12+. No known security vulnerabilities.
Install
xarray-spatial on PyPI
pip
pip install xarray-spatialuv
uv add xarray-spatialpoetry
poetry add xarray-spatialInstalling xarray-spatial
Before you install
Low friction: pure-Python wheel with six runtime dependencies (numba, scipy, xarray, numpy, urllib3, zstandard). Active maintenance—last commit 2026-08-08, release 28 days ago. Requires Python 3.12+.
License in practice
MIT license (permissive): you can use, modify, and distribute xarray-spatial freely in commercial and private projects with minimal restrictions, provided you include the license notice.
Quickstart
pip install xarray-spatial
import xarray
from xarray_spatial import geotiff
da = geotiff.open_geotiff('dem.tif')
geotiff.to_geotiff(da, 'output.tif', compression='zstd')
Requires Python 3.12 or later. GPU operations require additional NVIDIA libraries not bundled with the package.
Verify before relying
- Whether the 150+ functions cover your specific spatial analysis use case.
- Performance characteristics and memory overhead on CPU-only systems with large rasters.
- Stability of experimental GPU backends for production workflows.
- Timeline and scope of the 1.0.0 release and feature freeze impact on your needs.
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.12) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 6 — numba, scipy, xarray, numpy, urllib3, zstandard |
| Maintenance | actively maintained — 28 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 130,025/month — #11,655 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: xarray_spatial-0.10.17-py3-none-any.whl
Tags
More Information Analysis packages
A drop-in replacement for Python's standard…
permissive · top 100 on PyPI
pyarrowpyarrow provides Python bindings to Apache…
permissive · top 100 on PyPI
networkxNetworkX provides data structures and…
permissive · top 1,000 on PyPI
snowflake-connector-pythonConnects Python applications to Snowflake data…
permissive · top 1,000 on PyPI
contourpyContourPy calculates contours of 2D…
permissive · top 1,000 on PyPI
snowflake-snowpark-pythonSnowpark Python provides APIs to query and…
permissive · top 1,000 on PyPI
rasterixRasterix provides tools for analyzing raster…
permissive · top 15,000 on PyPI
rasterioRasterio reads and writes geospatial raster…
permissive · top 5,000 on PyPI
datashaderDatashader converts large datasets into…
permissive · top 15,000 on PyPI
odc-loaderConstructs xarray objects from parsed…
permissive · top 15,000 on PyPI
rio-tilerrio-tiler reads raster data from local and…
permissive · top 15,000 on PyPI
rioxarrayrioxarray extends xarray with geospatial and…
permissive · top 5,000 on PyPI
rasterstatsRasterstats computes summary statistics (mean,…
permissive · top 15,000 on PyPI
whiteboxWhitebox is a Python frontend to WhiteboxTools,…
permissive · top 15,000 on PyPI
exactextractexactextract computes zonal statistics—fast…
permissive · top 15,000 on PyPI
large-imageLarge Image provides Python methods to…
permissive · top 15,000 on PyPI