sp2Geo: Extracting information from an sp or spacetime object

View source: R/sp2Geo.R

sp2GeoR Documentation

Extracting information from an sp or spacetime object

Description

Extracting information from an sp or spacetime object

Usage

sp2Geo(spobj,spdata = NULL)

Arguments

spobj

An object of class sp or spacetime

spdata

Character: The name of data in the sp or spacetime object

Details

The function accepts an sp or spacetime object and returns information used by GeoModels functions. Spatial objects should have a coordinate reference system (CRS) defined; if the CRS is missing, sp2Geo issues a warning because projected/geographic status cannot be determined reliably. For STFDF and STIDF objects, the current conversion represents the temporal positions by the sequential indices 1, 2, ..., T; the original spacing of an irregular time index is therefore not preserved. To retain irregular temporal distances, use the explicit-coordinate interfaces of the relevant GeoModels functions and supply the numeric coordt values directly rather than passing spobj.

Value

A list with spatio-temporal information

Author(s)

Moreno Bevilacqua, moreno.bevilacqua89@gmail.com,https://sites.google.com/view/moreno-bevilacqua/home, Víctor Morales Oñate, victor.morales@uv.cl, https://sites.google.com/site/moralesonatevictor/, Christian Caamaño-Carrillo, chcaaman@ubiobio.cl,https://www.researchgate.net/profile/Christian-Caamano

Examples

if (requireNamespace("sp", quietly = TRUE)) {
# Define the spatial-coordinates of the points:
set.seed(3)
N <- 30 # number of location sites
x <- runif(N, 0, 1)
set.seed(6)
y <- runif(N, 0, 1)
coords <- cbind(x,y)

# Define spatial matrix covariates and regression parameters
X <- cbind(rep(1,N),runif(N))
# Define spatial matrix dependent variable
Y <- rnorm(nrow(X))

crs <- sp::CRS("EPSG:4326")
obj1 <- sp::SpatialPoints(coords, proj4string = crs)
obj2 <- sp::SpatialPointsDataFrame(
  coords, data = data.frame(X, Y), proj4string = crs
)

# sp2Geo info extraction
b <- sp2Geo(obj2,spdata = "Y")
class(b)
b
}

GeoModels documentation built on Sept. 23, 2026, 5:07 p.m.

Related to sp2Geo in GeoModels...