Sintrastes / MapAlgebra.jl

High-level declarative GIS processing library for Julia.
MIT License
2 stars 0 forks source link
declarative-programming functional-programming gdal gis julia osm profunctors

MapAlgebra.jl

Build Status

MapAlgebra.jl is a small Julia library wrapping GDAL.jl, providing a higher-level Raster type and some mathematical (algebraic) operations on said rasters.

Design Principles

MapAlgebra.jl's design and overall goals difer from existing GDAL wrappers in Julia such as ArchGDAL.jl in several ways:

Usage Examples

Estimate walking velocity:

import MapAlgebra

# Load some raw elevation data from a GeoTiff
elevation = MapAlgebra.readRaster("/path/to/elevation/raster.tif")

# Build an aniostropic slope raster from elevation (lazily)
slope = MapAlgebra.anisoSlope(elevation)

# Define a function to estimate walking velocity from slope.
toblers(θ) = 6 * e ^ (-3.5 * abs(tan(θ) + 0.05))

# Build up an anisotropic walking speed raster and write it to file.
MapAlgebra.writeToFile(toblers(slope), "/path/to/out.tif")

Estimate walking velocity (fluent/function chaining style):

@pipe MapAlgebra.readRaster("/path/to/elevation/raster.tif")
    |> MapAlgebra.anisoSlope(_)
    |> map((θ) -> 6 * e ^ (-3.5 * abs(tan(θ) + 0.05)), _)
    |> MapAlgebra.writeToFile(_, "/path/to/out.tif")

Take the max of all raster bands point-wise:

@pipe MapAlgebra.readRaster("/path/to/multi-band.tif")
    |> map(max, _)