At makepath, we are committed to the open source community. We are proud to announce the release of Xarray-Spatial, a spatial analysis Python library pioneered by one of our founders, Brendan Collins.
TL;DR? Xarray-Spatial is:
📍 A Fast, Accurate Python library for Raster Operations
⚡️ Extensible with Numba
⏩ Scalable with Dask
🎊 Free of GDAL / GEOS Dependencies
🌍 Designed for General-Purpose Spatial Processing, and is Geared Towards GIS Professionals
Xarray-Spatial implements common raster analysis functions using Numba and provides an easy-to-install, easy-to-extend codebase for raster analysis.
Why this matters
We are building tools to better understand our world and deal with our ever-increasing challenges.
Xarray-Spatial provides free open source spatial analytics for GIS applications.
We invite you to become a contributor to this project!
We think that the best tools to understand our world are open to everyone, and are refined by the collective wisdom of people who care.
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 / GEOS, which makes it fully extensible in Python but does limit the breadth of operations that can be covered. Xarray-Spatial is meant to include the core raster-analysis functions needed for GIS developers / analysts, implemented independently of the non-Python geostack.
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
- Normalized Difference Vegetation Index (NDVI)
- Focal Statistics
- Zonal Statistics
- Zonal Cross Tabulate
- Bump Mapping
- Perlin Noise
- Procedural Terrain Generation
Xarray-Spatial and GDAL
Within the Python ecosystem, many geospatial libraries interface with the GDAL C++ library for raster and vector input, output, and analysis (e.g. rasterio, rasterstats, geopandas). GDAL is robust, performant, and has decades of great work behind it. For years, off-loading expensive computations to the C/C++ level in this way has been a key performance strategy for Python libraries (obviously…Python itself is implemented in C!).
However, wrapping GDAL has a few drawbacks for Python developers and data scientists:
- GDAL can be a pain to build / install.
- GDAL is hard for Python developers/analysts to extend, because it requires understanding multiple languages.
- GDAL’s data structures are defined at the C/C++ level, which constrains how they can be accessed from Python.
With the introduction of projects like Numba, Python gained new ways to provide high-performance code directly in Python, without depending on or being constrained by separate C/C++ extensions. Xarray-Spatial implements algorithms using Numba and Dask, making all of its source code available as pure Python without any “black box” barriers that obscure what is going on and prevent full optimization. Projects can make use of the functionality provided by Xarray-Spatial where available, while still using GDAL where required for other tasks.
Where does this library fit into the ecosystem?
Interested in using xarray-spatial?
You can find the library on github here.
Thank you to Jim Bednar at Anaconda for reading a draft of this and contributing to the explanation of rasters. Thank you the whole Datadshader team. Some of the work that led to this library was done through an SBIR NASA Grant. This would not have been possible without them. Thank you to all present and future contributors of the library. We look forward to continuing to collaborate!
Questions? Thoughts? Ideas? Let us know in the comments, or email us at email@example.com.