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/
m = Map() m.add_raster(image_path='Landsat8.tif', bands=[4, 3, 2])
Output:
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.
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.