Create netgeom column for edges, observed sites, and/or prediction sites in a Landscape Network (LSN).
create_netgeom(sf_data, type = NULL, overwrite = FALSE)
An sf
object with LINESTING or POINT geometry
created using link{lsn_to_ssn}
(see Details).
Character string defining geometry type of
sf_data
. Default = NULL
.
Logical indicating whether existing data should be
overwritten if present. Default = FALSE
.
An sf
object containing the original data from
sf_data
and an additional column named netgeom.
Most users will not need to run create_netgeom
themselves because it is called internally when lsn_to_ssn
is run or an SSN
is imported using
link[SSN2]{ssn_import}
found in the SSN2
package. For users who do wish to run create_netgeom
, the
sf_data
object must represent edges, observed sites, or
prediction sites in a SSN
object created using
link{lsn_to_ssn}
.
The netgeom column contains information in character format used
to describe the topology of the LSN. The format and content of
the netgeom column differs depending on whether sf_data
contains LINESTRING (edges) or POINT (observed or prediction
sites) geometry. For edges, the netgeom format is:
'ENETWORK (netID, rid, upDist)'
For observed or prediction sites, the netgeom format is:
'SNETWORK (netID, rid, upDist, ratio, pid, locID)'
The rid, ratio, upDist, netID, pid, and locID columns must be
present in sf_data
before netgeom is added.
If overwrite = TRUE
and a column named netgeom is present in
sf_data
, the data will be overwritten. Default = FALSE.
## Create local temporary copy of MiddleFork04.ssn found in
## the SSN2 package. Only necessary for this example.
copy_lsn_to_temp()
# Import the SSN object with prediction points, pred1km
mf04<- ssn_import(
paste0(tempdir(), "/MiddleFork04.ssn"),
predpts = c("pred1km"),
overwrite = TRUE
)
# Recalculate the netgeom column for the observed sites
sf_obs <- create_netgeom(
mf04$obs,
type = "POINT",
overwrite = TRUE
)
# Recalculate the netgeom column for the edges
sf_edges <- create_netgeom(
mf04$edges,
type = "LINESTRING",
overwrite = TRUE
)