Map Algebra with NumPy
Inspired by the ARC/INFO GRID implementation of Map Algebra.
Installation
# PyPI
pip install glidergun
# UV
uv add glidergun
For CUDA acceleration, install the PyTorch CUDA wheels before installing glidergun.
Installation
# PyPI
pip install glidergun
# UV
uv add glidergun
For CUDA acceleration, install the PyTorch CUDA wheels before installing glidergun.
# PyPI
pip install torch torchvision --index-url https://download.pytorch.org/whl/cu130
# PyPI
pip install torch torchvision --index-url https://download.pytorch.org/whl/cu130
pip install glidergun
# UV
uv add torch torchvision --index pytorch-cu130=https://download.pytorch.org/whl/cu130
uv add glidergun
Getting Started
Terrain analysis
# Downloads a Copernicus DEM and creates a hillshade GeoTIFF.
# Downloads a Copernicus DEM and creates a hillshade GeoTIFF.
from glidergun import grid
dem = grid("cop-dem-glo-90", (137.8, 34.5, 141.1, 36.8))
hillshade = dem.hillshade()
dem.save("dem.tif")
hillshade.save("hillshade.tif", "uint8")
Image segmentation
# Downloads a Bing aerial image, runs SAM segmentation,
# and saves the detected objects as GeoJSON.
# Downloads a Bing aerial image, runs SAM segmentation,
# and saves the detected objects as GeoJSON.
from glidergun import stack
bing = stack("microsoft", (-123.164, 49.272, -123.162, 49.273), max_tiles=100)
bing.save("vancouver.tif")
sam = bing.sam("tree", "house", "car")
sam.to_geojson().save("vancouver.json")
Both examples access online services. Running SAM may require Hugging Face authorization or a model checkpoint, depending on your model setup.
Library Overview
Glidergun is a Python library for geospatial raster analysis and map algebra. It brings NumPy-style expressions to georeferenced raster data, keeping coordinate reference system (CRS), extent, and cell size attached to each grid. It is designed for interactive exploration in notebooks as well as repeatable analysis scripts.
Grids and stacks
The main objects are Grid and Stack. A Grid represents one raster band; a Stack groups aligned bands, such as the red, green, and blue channels of an image. Create them with grid(...) and stack(...) from NumPy arrays, raster files, Rasterio datasets, or supported remote sources.
Map algebra and raster analysis
Use arithmetic and comparison operators directly on grids and stacks; bitwise operators are available for compatible data types. Operations can combine raster data with scalars or other grids. When grids share a CRS but differ in extent or cell size, Glidergun can align them for the operation. Conditional expressions, reclassification, range clipping, scaling, and band aggregation are also available.
For spatial analysis, Glidergun includes focal neighborhood statistics and filters, zonal statistics, interpolation, terrain derivatives such as slope and aspect, hillshade, and rasterization. Convert raster cells to point or polygon features, or burn geometries and points into a grid. Grids can also be clipped, resampled, reprojected, mosaicked, and processed in tiles.
Data access and output
Read and write raster formats supported by Rasterio/GDAL. Search STAC catalogs such as Microsoft Planetary Computer for imagery and elevation data, or load supported web tile services and basemaps. Save results as raster files or serialize them to bytes; export vector features as GeoJSON.
Imagery and interactive workflows
Stacks support per-band operations and conversion to NumPy arrays. Computer-vision workflows include image georeferencing with LoFTR and text-prompted segmentation with SAM. In notebooks, preview and animate grids and stacks; in supported ArcGIS Pro and QGIS sessions, add results to the active map.
Metadata
Release files for glidergun 0.9.192
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 |
|---|---|---|---|---|
| glidergun-0.9.192.tar.gz | 47.3 kB | Without provenance | Details for glidergun-0.9.192.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| glidergun-0.9.192-py3-none-any.whl | Python 3 | none | any | Details for glidergun-0.9.192-py3-none-any.whl |
Total release size: 98.2 kB
Release files / glidergun-0.9.192.tar.gz
| Download URL | glidergun-0.9.192.tar.gz |
|---|---|
| Size | 47.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
799f1ed0e99e22aa7fa2c948b86c6ebefc60eb49295c25a8fb402f3223154b3a
|
|
BLAKE2b-256 checksum How to use checksums |
512032bd8a47189384e6e91ba4307797044c27fd1189a1252ec9c10886450262
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.13.8 {"installer":{"name":"uv","version":"0.13.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / glidergun-0.9.192-py3-none-any.whl
| Download URL | glidergun-0.9.192-py3-none-any.whl |
|---|---|
| Size | 50.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d01f03ec063153f10f2bd16efec5532f0f9ebcd594e367f5bd239bcd31b11dd5
|
|
BLAKE2b-256 checksum How to use checksums |
c44ee1b8e0fc8704252683bd58d6d2dfb37ed38db27e875f6befe6882ee334ec
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.13.8 {"installer":{"name":"uv","version":"0.13.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for glidergun 0.9.192
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.