2024-07-10 –, Function (4.1)
Rasters.jl extends DimensionalData.jl for working with geospatial rasters. It abstracts over many kinds of multi-dimensional arrays stored in memory, on disk or in the cloud - from sources like GDAL and netcdf, to present spatial raster data as regular julia AbstractArray
s, but facilitate easy spatially aware indexing, manipulation, plotting and writing.
This talk will cover basic workflows and features for raster data manipulation with Rasters.jl.
Rasters.lj adds missing-value handling, tracking of coordinate reference system (crs), lazy operations on larger-than-memory arrays using DiskArrays.jl, and ability to select and plot rasters with rotated or skewed coordinates - to a base of named dimension indexing from DimensionalData.jl.
Scripts and packages built on Rasters.jl can treat Raster, RasterStack, and RasterSeries as black boxes. They may hold unopened GeoTiff or NetCDF filenames or urls, Arrays in memory, or CuArrays on the GPU - but they will all behave in essentially the same way - allowing spatial indexing, manipulation and plotting.
Rasters.jl also provides a range of common GIS tools for raster manipulation:
aggregate: aggregate data by the same or different amounts for each axis.
mosaic: join rasters covering different extents into a single array or file.
crop: shrink objects to specific dimension sizes or the extent of another object.
extend: extend objects to specific dimension sizes or the extent of another object.
trim: trims areas of missing values for arrays and across stack layers.
resample: resample data to a different size and projection, or snap to another object.
rasterize: rasterize GeoInterface compatible points and geometries.
extract: extract values from points or geometries.
zonal: calculate zonal statistics for an object masked by geometries.
mask`: mask an object by a polygon or Raster along X/Y, or other dimensions.
While less mature than similar packages in R or python, Rasters.jl already has many ease of use and performance advantages.
Operations like rasterization and masking are written in native Julia, so they are fast and work on geometry objects sourced from any packages that implement the GeoInteraface.jl interface.
DiskArrays integration means views, permutations, reductions and broadcasts can be performed over larger-than-memory arrays, only being applied when getindex
is finally called for a specific region.
Despite the additional behaviours and geospatial metadata they hold, Raster
objects are also just regular AbstractArray
s with standard Array
behavior. They work with most base methods, and across much of the Julia ecosystem. In most cases they retain their spatial metadata and the ability to be indexed by name, spatial coordinates, time or any other dimensions they may have, and will always plot appropriately in Plots.jl or Makie.jl.
Rafael is an Ecologist at the Center for Macroecology, Climate and Evolution in Copenhagen. He works on process-based ecological models of species distributions, dispersal, threats and extinction, and contributes to a variety of geospatial, modelling and visualization packages.
- DimensionalData.jl: named dimensions for julia data
- JuliaGeo BoF: shared interfaces and plans for geospatial julia
- Interfaces.jl: base and package interface tests for your objects
- What’s new with GeoInterface.jl: traits for interoperability
- GeometryOps.jl: Building a Comprehensive Native Geometry Package
- SpeciesDistributionModels.jl: an SDM workflow