A geospatial raster processing library for machine learning
Project description
When geospatial raster data is concerned in a machine learning pipeline, it is often required to extract meaningful features, such as vegetation indices (e.g., NDVI, EVI, NDRE, etc.) or textures. This package provides easy-to-use functions that can automatically calculates the features with one or several lines of codes in Python. It also has the functionality of extracting statistics based on shapefile (i.e., point or polygon) from a raster data. Any type of raster data is supported regardless of satellite or UAVs.
Key Features
- Stack raster bands
- Automatically calculate vegetation indices (supports 350+ indices)
- Extract raster values based on shapefile
- Clip raster based on polygon
Documentation
Detailed documentation with tutorials can be found here: https://raster4ml.readthedocs.io/en/latest/
How to Use?
- Stacking bands
stack_bands(image_paths=['Band_1.tif', 'Band_2.tif', 'Band_3.tif', 'Band_4.tif', 'Band_5.tif', 'Band_6.tif'], out_file='Stack.tif')
- Vegetation index calculation
VI = VegetationIndices(image_path='Landsat8.tif', wavelengths=[442.96, 482.04, 561.41, 654.59, 864.67, 1608.86, 2200.73]) VI.calculate(out_dir='vegetation_indices')
- Dynamic visualization in Jupyter Notebook
Output:m = Map() m.add_raster(image_path='Landsat8.tif', bands=[4, 3, 2])
How to Install?
Dependencies
Raster4ML is built on top of geopandas, rasterio, fiona, pyproj, rtree, shapely, numpy, and pandas.
Virtual Environment
It is prefered to use a virtual environment for working with this package. Use Anaconda or Miniconda to create a seperate environment and then install the package and its dependencies there.
conda create --name raster4ml python=3
conda activate raster4ml
Windows
To install on Windows, first download the wheel files for GDAL, rasterio, and fiona from Christoph Gohlke's website (🤗Thanks Christoph🤗). Go to his website, press Ctrl+F
and type gdal. Download the GDAL file that mostly matches your computer configuration (64-bit or 32-bit) and Python version.
After downloading it, cd
into the downloaded directory while the raster4ml
environment is activated. Then install using pip
. Do the same for rasterio and fiona.
pip install GDAL‑3.4.3‑cp310‑cp310‑win_amd64.whl
pip install rasterio‑1.2.10‑cp310‑cp310‑win_amd64.whl
pip install Fiona‑1.8.21‑cp310‑cp310‑win_amd64.whl
If these three are installed, the rest of the dependencies can be installed directly through Raster4ML's pip
distribution.
pip install raster4ml
Mac OS
Has not been tested yet. 😕
Linux
Has not been tested yet. 😕
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file raster4ml-0.1.3b0.tar.gz
.
File metadata
- Download URL: raster4ml-0.1.3b0.tar.gz
- Upload date:
- Size: 23.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f10fb88341ee09edb6c2b4301a40549ce4093aeb2e5ca9ce1d10ac88f6fc99dc |
|
MD5 | 9029695c16e2b197c92b1d7202a9ec6b |
|
BLAKE2b-256 | 9c4ae13d26debdcff01266c6915acaf6e56e96281cdd28c5f4c84d228e23df91 |
File details
Details for the file raster4ml-0.1.3b0-py3-none-any.whl
.
File metadata
- Download URL: raster4ml-0.1.3b0-py3-none-any.whl
- Upload date:
- Size: 23.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7ffc6d9a04f198da671dd53d3b1ef2500731e81071506b36b454d7afe8127ea1 |
|
MD5 | 5677ce5c5fe7ed91a1c177fde9ba1740 |
|
BLAKE2b-256 | caa44f39747555c482c8aa063cb1aa566ad521f215c394f6b0ce03a3f01f1896 |