API

Types

AdditiveModel

AdditiveModel(models::Vector)

A boosting-style composite surrogate. Each model is fitted to the residuals (target minus the sum of all previous model predictions), and the final prediction is the sum of all model predictions.

Examples

model = AdditiveModel([ImplicitTerrain.MLP(), ImplicitTerrain.MLP()])
fit!(model, raster; steps=1000)
predict(model, raster)

CategoricalRasterWrap

CategoricalRasterWrap(r::Raster; kernel)

A GeoSurrogate for categorical rasters using kernel smoothing. Here, “categorical raster” refers to a raster where its numerical data is associated with discrete categories (e.g. land cover types).

GeomWrap

GeomWrap(geometry; kernel)

A GeoSurrogate representing a geometry. Coordinates contained in the geometry will result in predict(::GeomWrap, coords)) == 1.0. Coordinates “far” will be 0.0. “Near” coordinates are determined by the kernel function evaluated at the distance between the coordinate and the geometry.

IDW

IDW(r::Raster; power=2)

Inverse Distance Weighting surrogate. Predicts values as a weighted average of known data points, where weights are inversely proportional to the distance raised to power.

Examples

model = IDW(raster)
predict(model, (x, y))
predict(model, raster)

LinReg

No documentation found for public binding GeoSurrogates.LinReg.

Summary

struct GeoSurrogates.LinReg{F<:StatsModels.FormulaTerm, T<:Number}

Fields

formula :: F<:StatsModels.FormulaTerm
β       :: Array{T<:Number, 1}

Supertype Hierarchy

GeoSurrogates.LinReg{F<:StatsModels.FormulaTerm, T<:Number} <: GeoSurrogates.GeoSurrogate <: Any

RBF

RBF(r::Raster; kernel=:gaussian, epsilon=1.0, poly_degree=0)

Radial Basis Function surrogate. Interpolates scattered data using a kernel applied to pairwise distances. Set poly_degree=1 to augment with a linear polynomial term.

Available kernels: :gaussian, :multiquadric, :inverse_multiquadric, :linear, :cubic, :thin_plate_spline.

Examples

model = RBF(raster; kernel=:gaussian, epsilon=1.0)
predict(model, (x, y))

RasterWrap

RasterWrap(r::Raster; int = BSpline(Linear()), ext = nothing)

A GeoSurrogate with interpolation (and optional extrapolation).

TPS

TPS(r::Raster; regularization=0.0)

Thin Plate Spline surrogate. Always includes an affine term (a₀ + a₁x + a₂y). Set regularization > 0 for smoothing instead of exact interpolation.

Examples

model = TPS(raster)
predict(model, (x, y))

Functions

fit! {#fit!}

Fit a statistical model in-place.

fit!(model::WindSIREN, x::AbstractMatrix, y::AbstractMatrix; steps=1, losses=nothing)

Train the model on coordinate-value pairs.

  • x: 2×N matrix of normalized (x, y) coordinates
  • y: 2×N matrix of (u, v) wind components
  • losses: Optional vector to collect per-step loss values

Returns the fitted model.

fit!(model::WindSIREN, u::Raster, v::Raster; steps=1, losses=nothing)

Train the model on u and v wind component rasters. Rasters must be normalized before fitting. Pass a vector for losses to collect per-step loss values.

Returns the fitted model.

fit!(model::WindSIREN, uv::RasterStack; steps=1, losses=nothing)

Train the model on a RasterStack containing :u and :v layers. Pass a vector for losses to collect per-step loss values.

Returns the fitted model.

fit!(model::CatSIREN, x::AbstractMatrix, y::AbstractMatrix; steps=1, losses=nothing)

Train the model on coordinate-value pairs.

  • x: 2×N matrix of normalized (x, y) coordinates
  • y: n_classes×N one-hot encoded matrix
  • losses: Optional vector to collect per-step loss values

Returns the fitted model.

fit!(model::CatSIREN, r::Raster; steps=1, losses=nothing)

Train the model on a categorical raster. The raster values should be categorical labels (integers or any comparable type). Pass a vector for losses to collect per-step loss values.

Returns the fitted model.

gaussian

No documentation found for public binding GeoSurrogates.gaussian.

GeoSurrogates.gaussian is a Function.

# 1 method for generic function "gaussian" from GeoSurrogates:
 [1] gaussian(u, k)
     @ ~/work/GeoSurrogates.jl/GeoSurrogates.jl/src/GeoSurrogates.jl:466

normalize

No documentation found for public binding GeoSurrogates.normalize.

GeoSurrogates.normalize is a Function.

# 5 methods for generic function "normalize" from GeoSurrogates:
 [1] normalize(r::Rasters.Raster)
     @ ~/work/GeoSurrogates.jl/GeoSurrogates.jl/src/GeoSurrogates.jl:31
 [2] normalize(x::AbstractArray{<:Union{Missing, Number}})
     @ ~/work/GeoSurrogates.jl/GeoSurrogates.jl/src/GeoSurrogates.jl:18
 [3] normalize(dim::DimensionalData.Dimensions.Dimension)
     @ ~/work/GeoSurrogates.jl/GeoSurrogates.jl/src/GeoSurrogates.jl:29
 [4] normalize(nt::NamedTuple)
     @ ~/work/GeoSurrogates.jl/GeoSurrogates.jl/src/GeoSurrogates.jl:37
 [5] normalize(x)
     @ ~/work/GeoSurrogates.jl/GeoSurrogates.jl/src/GeoSurrogates.jl:27

predict

predict(model::RegressionModel, [newX])

Form the predicted response of model. An object with new covariate values newX can be supplied, which should have the same type and structure as that used to fit model; e.g. for a GLM it would generally be a DataFrame with the same variable names as the original predictors.

predict(model::WindSIREN, x::AbstractMatrix) -> Matrix{Float32}

Predict wind components (u, v) for input coordinates. Input x should be a 2×N matrix of normalized coordinates. Returns a 2×N matrix where row 1 is u and row 2 is v.

predict(model::WindSIREN, coords::Tuple) -> Tuple{Float32, Float32}

Predict wind components (u, v) for a single coordinate tuple (x, y). Returns (u, v) tuple.

predict(model::WindSIREN, r::Raster) -> Tuple{Raster, Raster}

Predict wind components for all coordinates in a raster. Returns tuple of (uraster, vraster).

predict(model::CatSIREN, x::AbstractMatrix) -> Matrix{Float32}

Predict class probabilities for input coordinates. Input x should be a 2×N matrix of normalized coordinates. Returns an n_classes×N matrix of probabilities (columns sum to 1).

predict(model::CatSIREN, coords::Tuple) -> Dict

Predict class probabilities for a single coordinate tuple (x, y). Returns a Dict mapping class labels to probabilities.

predict(model::CatSIREN, r::Raster) -> Raster

Predict class probabilities for all coordinates in a raster. Returns a Raster where each cell contains a Dict mapping class labels to probabilities.

Constants

CatSIREN

CatSIREN(n_classes; kwargs...)

A SIREN (Sinusoidal Representation Network) for creating implicit neural representations of categorical raster data (e.g., Landfire fuel models). Uses periodic sine activations with a softmax output layer to ensure predictions sum to 1.

Arguments

  • n_classes::Int: Number of output classes (required)

Keyword Arguments

  • in::Int = 2: Input dimension (typically 2 for x, y coordinates)
  • hidden::Int = 256: Number of hidden units per layer
  • n_hidden::Int = 3: Number of hidden layers
  • ω0::Float32 = 30f0: Frequency scaling for first layer
  • ωh::Float32 = 1f0: Frequency scaling for hidden layers
  • rng::AbstractRNG = Random.MersenneTwister(42): Random number generator
  • alg = Adam(0.0001f0): Optimizer algorithm

Example

# For a categorical raster with 10 unique classes
model = CatSIREN(10)
fit!(model, categorical_raster; steps=1000)
probs = predict(model, test_raster)  # Returns raster of probability vectors

References

  • Sitzmann et al. “Implicit Neural Representations with Periodic Activation Functions” (2020)
CatSIREN(r::Raster; kwargs...)

Create a CatSIREN model from a categorical raster, automatically determining the number of classes from the unique values in the raster.

ImplicitTerrain

No docstring found for public module GeoSurrogates.ImplicitTerrain. Module does not have any public names.


Package description from README.md: CI Docs Build Stable Docs Dev Docs

GeoSurrogates.jl

Implicit Neural Representations for Geospatial Data

GeoSurrogates.jl creates surrogate models of geospatial data. It provides multiple approaches to learn continuous functions from spatial raster data, using both classical methods and neural networks to create compact, efficient representations of geographic phenomena.

Features

  • Classical Surrogates – Linear regression, inverse distance weighting, radial basis functions, thin plate splines, and B-spline interpolation
  • Neural Network Surrogates – SIREN (Sinusoidal Representation Networks) for terrain, wind fields, and categorical data
  • Rasters.jl Integration – Works directly with Raster and RasterStack objects
  • Arbitrary Resolution – Predict at any resolution, not just the training grid
  • Memory Efficient – Neural networks as compact alternatives to storing full rasters
  • ComposableAdditiveModel for boosting-style ensembles of surrogates

Installation

using Pkg
Pkg.add("GeoSurrogates")

Quick Example

using GeoSurrogates, Rasters

# Load a raster
elev = Raster("path/to/elevation.tif")

# Create a simple interpolation-based surrogate
surrogate = RasterWrap(elev)

# Predict at any coordinate
predict(surrogate, (-105.5, 40.2))

# Or create a neural network surrogate for compression
model = ImplicitTerrain.Model()
fit!(model, normalize(elev); steps=1000)

# Predict on a new raster grid
predicted = predict(model, new_raster)

Surrogate Types

Type Description Use Case
RasterWrap B-spline interpolation Fast exact interpolation
LinReg Linear regression Simple trend modeling
IDW Inverse distance weighting Scattered data interpolation
RBF Radial basis functions Flexible kernel interpolation
TPS Thin plate splines Smooth surface fitting
GeomWrap Distance-based kernel Geometry influence fields
CategoricalRasterWrap Kernel smoothing Categorical raster data
ImplicitTerrain.Model Cascaded SIREN Terrain compression
WindSurrogate.WindSIREN SIREN for vectors Wind field modeling
CatSIREN.CatSIREN SIREN with softmax Categorical classification
AdditiveModel Boosted ensemble Composing multiple surrogates

References

WindSurrogate

No docstring found for public module GeoSurrogates.WindSurrogate. Module does not have any public names.


Package description from README.md: CI Docs Build Stable Docs Dev Docs

GeoSurrogates.jl

Implicit Neural Representations for Geospatial Data

GeoSurrogates.jl creates surrogate models of geospatial data. It provides multiple approaches to learn continuous functions from spatial raster data, using both classical methods and neural networks to create compact, efficient representations of geographic phenomena.

Features

  • Classical Surrogates – Linear regression, inverse distance weighting, radial basis functions, thin plate splines, and B-spline interpolation
  • Neural Network Surrogates – SIREN (Sinusoidal Representation Networks) for terrain, wind fields, and categorical data
  • Rasters.jl Integration – Works directly with Raster and RasterStack objects
  • Arbitrary Resolution – Predict at any resolution, not just the training grid
  • Memory Efficient – Neural networks as compact alternatives to storing full rasters
  • ComposableAdditiveModel for boosting-style ensembles of surrogates

Installation

using Pkg
Pkg.add("GeoSurrogates")

Quick Example

using GeoSurrogates, Rasters

# Load a raster
elev = Raster("path/to/elevation.tif")

# Create a simple interpolation-based surrogate
surrogate = RasterWrap(elev)

# Predict at any coordinate
predict(surrogate, (-105.5, 40.2))

# Or create a neural network surrogate for compression
model = ImplicitTerrain.Model()
fit!(model, normalize(elev); steps=1000)

# Predict on a new raster grid
predicted = predict(model, new_raster)

Surrogate Types

Type Description Use Case
RasterWrap B-spline interpolation Fast exact interpolation
LinReg Linear regression Simple trend modeling
IDW Inverse distance weighting Scattered data interpolation
RBF Radial basis functions Flexible kernel interpolation
TPS Thin plate splines Smooth surface fitting
GeomWrap Distance-based kernel Geometry influence fields
CategoricalRasterWrap Kernel smoothing Categorical raster data
ImplicitTerrain.Model Cascaded SIREN Terrain compression
WindSurrogate.WindSIREN SIREN for vectors Wind field modeling
CatSIREN.CatSIREN SIREN with softmax Categorical classification
AdditiveModel Boosted ensemble Composing multiple surrogates

References