fm_zm: Add or remove Z/M information

View source: R/mesh.R

fm_zmR Documentation

Add or remove Z/M information

Description

[Experimental] Add and/or remove Z and/or M information from simple feature geometries.

Usage

fm_zm(x, ...)

## S3 method for class 'sf'
fm_zm(x, ...)

## S3 method for class 'sfc'
fm_zm(x, ..., add = NULL, remove = NULL, target = NULL)

## S3 method for class 'list'
fm_zm(x, ..., add = NULL, remove = NULL, target = NULL)

## S3 method for class 'sfg'
fm_zm(x, ..., add = NULL, remove = NULL, target = NULL)

## S3 method for class 'numeric'
fm_zm(x, ..., add = NULL, remove = NULL, target = NULL, input = NULL)

## S3 method for class 'matrix'
fm_zm(x, ..., add = NULL, remove = NULL, target = NULL, input = NULL)

fm_zm_input(x, ...)

## S3 method for class 'sf'
fm_zm_input(x, ...)

## S3 method for class 'sfc'
fm_zm_input(x, ...)

## S3 method for class 'list'
fm_zm_input(x, ...)

## S3 method for class 'sfg'
fm_zm_input(x, ...)

## S3 method for class 'numeric'
fm_zm_input(x, ..., input = NULL)

## S3 method for class 'matrix'
fm_zm_input(x, ..., input = NULL)

fm_zm_target(input, add = NULL, remove = NULL, target = NULL)

Arguments

x

An object to modify

...

Further arguments passed to methods

add

character; one of NULL, "Z", "M", or "ZM". Specifies which dimensions to add.

remove

character; one of NULL, "Z", "M", or "ZM". Specifies which dimensions to remove.

target

character; one of "XY", "XYZ", "XYM", or "XYZM". Specifies the target dimension format. If provided, overrides add and remove. When both add and remove are NULL, the default target is the smallest format that can hold all the inputs without loss of information.

input

character or character vector; one of NULL, "XY", "XYZ", "XYM", or "XYZM". Specifies the input dimension format. If NULL (default), the input format is inferred from the number of columns in x (for matrices/numerics) or from the geometry type (for sfc objects).

Value

An object of the same class as x, with modified Z/M dimensions.

Functions

  • fm_zm_input(): Find the set of distinct XY/XYZ/XYM/XYZM types

  • fm_zm_target(): Determines the target XY/XYZ/XYM/XYZM format

Author(s)

Finn Lindgren Finn.Lindgren@gmail.com

See Also

sf::st_zm() that supports a subset of these operations.

Examples

fm_zm(fmexample$loc_sf, add = "Z")

fm_zm_input(fmexample$loc_sf)

fm_zm_target(c("XY", "XYZ"))
fm_zm_target("XY", add = "Z")
fm_zm_target(c("XY", "XYZM"), remove = "M")


fmesher documentation built on Feb. 19, 2026, 9:07 a.m.