Package 'rusterize'

Title: Extremely fast rasterization engine built in Rust for R
Description: Rasterization engine that handles all sf-supported geometries and returns a terra object.
Authors: Tommaso Trotto [aut, cre]
Maintainer: Tommaso Trotto <[email protected]>
License: MIT + file LICENSE
Version: 0.1.0
Built: 2026-07-11 01:21:49 UTC
Source: https://github.com/ttrotto/rusterize

Help Index


Extremely fast rasterization engine built in Rust for R

Description

Extremely fast rasterization engine built in Rust for R

Usage

rusterize(
  data,
  like = NULL,
  resolution = NULL,
  out_shape = NULL,
  extent = NULL,
  field = NULL,
  by = NULL,
  burn = NULL,
  fun = "last",
  background = NA,
  encoding = "dense",
  all_touched = FALSE,
  tap = FALSE,
  dtype = "double"
)

Arguments

data

An sf or sfc object of geometries.

like

A terra template used as a spatial blueprint (resolution, dimension, extent). Mutually exclusive with resolution, out_shape, and extent.

resolution

Pixel resolution as c(xres, yres) (or a list).

out_shape

Output raster dimensions as c(nrows, ncols) (or a list).

extent

Spatial bounding box as c(xmin, ymin, xmax, ymax) (or a list).

field

Column name to use for pixel values. Mutually exclusive with burn.

by

Column used for grouping. Each group is rasterized into a distinct band in the output.

burn

A static value or a list of values to apply to each geometries. If a vector, it must match the length of the geometry data. Mutually exclusive with field. If a vector, its dtype should match the output dtype, else it will be internally casted.

fun

Pixel function to use when burning geometries. Available options: sum, first, last, min, max, count, or any.

background

Value assigned to pixels not covered by any geometry. Defaults to NA.

encoding

The format of the returned object: "dense" or "sparse".

all_touched

If True, every pixel touched by a geometry is burned.

tap

Target Aligned Pixels: aligns the extent to the pixel resolution.

dtype

Output data type: "integer" or "double".

Value

A terra object or a SparseArray in COOrdinate format.