Learn R Programming

geodimension (version 1.0.2)

add_geometry: Add geometry to a level

Description

A level can have several geometries (point, polygon or line). This function adds the geometry of the layer to the level.

Usage

add_geometry(gl, layer, layer_key, level_key)

# S3 method for geolevel add_geometry(gl, layer = NULL, layer_key = NULL, level_key = NULL)

Value

A geolevel.

Arguments

gl

A geolevel object.

layer

A sf object.

layer_key

A vector of string.

level_key

A vector of string.

Details

The association of the geometry to the existing instances is done through join using the level and layer keys.

If none is indicated, by default the key defined in the level is considered.

See Also

Other geolevel definition functions: geolevel()

Examples

Run this code
us_state_point <-
  coordinates_to_geometry(layer_us_state,
                          lon_lat = c("intptlon", "intptlat"))

state <-
  geolevel(name = "state",
           layer = layer_us_state,
           key = c("geoid")) |>
  add_geometry(layer = us_state_point)

Run the code above in your browser using DataLab