In a nutshell, buzzard
reads and writes geospatial raster and vector data.
- buzzard is
- buzzard contains
- Simple example
- Advanced (and fun) examples
- Features
- Future features summary
- Dependencies
- How to install
- How to test
- Contributions and feedback
- License and Notice
- Other pages
- a python library
- a
gdal
/ogr
/osr
wrapper - designed to hide all cumbersome operations while working with GIS files
- designed for data science workflows
- under active development (see
TODO
) - tested with
pytest
in python 2.7 and python 3.6
- a class to open/read/write/create GIS files:
DataSource
- classes to interact with opened files:
RasterPhysical
Vector
- a toolbox class designed to locate a rectangle in both image space and geometry space:
Footprint
This example illustrates visualization of a raster based on polygons.
import buzzard as buzz
import numpy as np
import matplotlib.pyplot as plt
rgb_path = 'path/to/raster.file'
polygons_path = 'path/to/vector.file'
ds = buzz.DataSource()
ds.open_raster('rgb', rgb_path)
ds.open_vector('polygons', polygons_path)
# Iterate over the polygons as shapely objects
for poly in ds.polygons.iter_data(None):
# Compute the Footprint bounding poly
fp = ds.rgb.fp.intersection(poly)
# Read rgb at `fp` to a numpy array
rgb = ds.rgb.get_data(band=(1, 2, 3), fp=fp).astype('uint8')
alpha = ds.rgb.get_data(band=4, fp=fp).astype('uint8')
# Create a boolean mask as a numpy array from a shapely polygon
mask = np.invert(fp.burn_polygons(poly))
# Darken pixels outside of polygon, set nodata pixels to red
rgb[mask] = (rgb[mask] * 0.5).astype(np.uint8)
rgb[alpha == 0] = [255, 0, 0]
plt.imshow(rgb)
plt.show()
Additional examples can be found here: jupyter notebook.
- Raster and vector files opening
- Raster and vector files reading to
numpy.ndarray
,shapely
objects,geojson
and raw coordinates - Raster and vector files writing from
numpy.ndarray
,shapely
objects,geojson
and raw coordinates - Raster and vector files creation
- Powerful manipulations of raster windows
- Spatial reference homogenization between opened files like a
GIS software
- Wheels with
osgeo
binaries included - Advanced spatial reference homogenization using
gdal
warping functions - More tools, syntaxes and algorithms to work with raster datasets that don't fit in memory
- Strong support of non north-up / west-left footprints
- Data visualization tools
- Strong performance improvements
- Floating point precision loss handling improvements
The following table lists dependencies along with the minimum version, their status for the project and the related license.
Library | Version | Last | Mandatory | License | Comment |
---|---|---|---|---|---|
gdal | >=2.1.3 | 2.2.2 | Yes | MIT/X | Hard to install. Will be included in buzzard wheels |
opencv-python | >=3.1.0 | 3.3.0.10 | Yes | 3-clause BSD | Easy to install with opencv-python wheels. Will be optional |
shapely | >=1.6.1 | 1.6.1 | Yes | 3-clause BSD | |
affine | >=2.0.0 | 2.1.0 | Yes | 3-clause BSD | |
numpy | >=1.13.0 | 1.13.1 | Yes | numpy | |
scipy | >=0.19.1 | 0.19.1 | Yes | scipy | |
pint | >=0.8.1 | 0.8.1 | Yes | 3-clause BSD | |
six | >=1.11.0 | 1.11.0 | Yes | MIT | |
chainmap | >=1.0.2 | 1.0.2 | Yes | Python 2.7 license | Only for python <3.2 |
pytest | >=3.2.2 | 3.2.2 | No | MIT | Only for tests |
attrdict | >=2.0.0 | 2.0.0 | Yes | MIT | |
geopandas | 0.3.0 | No | 3-clause BSD | Future dependency. Will be optional |
# Install GDAL
# Windows: http://www.lfd.uci.edu/~gohlke/pythonlibs/#gdal
# MacOS: brew install gdal && brew tap osgeo/osgeo4mac && brew tap --repair && brew install gdal2 && export PATH="/usr/local/opt/gdal2/bin:$PATH" && pip install 'gdal==2.1.3'
# Ubuntu: apt-get install python-gdal=2.1.3+dfsg-1~xenial2 libproj-dev libgdal-dev gdal-bin
# Install buzzard
pip install buzzard
# Install Anaconda
# https://www.anaconda.com/download/
# Create env
conda create -n buzz python=3.6 gdal opencv scipy shapely -c 'conda-forge'
# Activate env
# Windows: activate buzz
# Linux, MacOS: source activate buzz
# Install buzzard
pip install buzzard
git clone https://github.com/airware/buzzard
pip install -r buzzard/requirements-dev.txt
pytest buzzard/buzzard/test
Hosted soon, in the meantime
- look at docstrings in code
- get familiar with the public classes
- play with the exemples in examples.ipynb
Welcome to the buzzard
project! We appreciate any contribution and feedback, your proposals and pull requests will be considered and responded to. For more information, see the CONTRIBUTING.md
file.
See AUTHORS