importSSN: Import an object of class SpatialStreamNetwork

View source: R/importSSN.R

importSSNR Documentation

Import an object of class SpatialStreamNetwork

Description

The importSSN function reads spatial data from a .ssn folder and to create a SpatialStreamNetwork object

Usage

importSSN(filepath, predpts = NULL, o.write = FALSE)

Arguments

filepath

path name to the .ssn folder, in string format including quotes. Also include the .ssn folder in the path name

predpts

default = NULL. Prediction points shapefile name enclosed in quotes. When writing, omit the .shp extension. Prediction points must reside in the .ssn directory and be generated from the same landscape network as the other spatial data in the .ssn directory

o.write

default = FALSE. If TRUE, overwrite existing binaryID.db files

Details

The importSSN function imports spatial data from a .ssn folder to create a SpatialStreamNetwork-class object. The information contained in the .ssn folder is generated in a geographic information system using the Spatial Tools for the Analysis of River Systems (STARS) tools for ArcGIS version 9.3.1. A detailed description of the spatial data format is provided in Peterson (2011).

The information contained in the netID text files is imported into an SQLite database, binaryID.db, which is stored in the .ssn directory. This information is used internally by createDistMat and glmssn to calculate the data necessary to fit a spatial statistical model to stream network data. If o.write = TRUE (o.write = FALSE is the default) and a binaryID.db file already exists within the .ssn directory, it will be overwriten when the SpatialStreamNetwork object is created.

A SpatialStreamNetwork object may contain multiple sets of prediction points, which are contained in separate shapefiles. One prediction point shapefile may be imported using importSSN. The importPredpts function allows users to import additional sets of prediction sites to a an existing SpatialStreamNetwork object. The prediction points ID is set to the base name the shapefile.

Value

importSSN returns an object of class SpatialStreamNetwork. It also creates and stores a SQLite database, binaryID.db, within the .ssn directory.

Author(s)

Erin E. Peterson support@SpatialStreamNetworks.com

References

Peterson E.E.(2011)STARS: Spatial Tools for the Analysis of River Systems: A tutorial. CSIRO Technical Report EP111313. 42p.

See Also

importPredpts for adding prediction points after a SpatialStreamNetwork object has been created. createDistMat to create distance matrices among points, both among observed, between observed and predicted, and among predicted. createSSN for creating SSN objects from scratch for simulation purposes.

Examples


library(SSN)
# for examples, copy MiddleFork04.ssn directory to R's temporary directory
copyLSN2temp()

# Create a SpatialStreamNetwork object that does not contain prediction points
mf04 <- importSSN(paste0(tempdir(),'/MiddleFork04.ssn'), o.write = TRUE)

# Create a SpatialStreamNetork object that also contains prediction sites
mf04p <- importSSN(paste0(tempdir(),'/MiddleFork04.ssn'), 
  predpts = "pred1km", o.write = TRUE)
names(mf04p)

#NOT RUN Some graphics to explore imported object
#hist(mf04, "Summer_mn")
#boxplot(mf04, "Summer_mn")
#plot(mf04, cex = .8, xlab = "x", ylab = "y")
#plot(mf04p, PredPointsID = "pred1km", add = TRUE, pch = 1) #add to previous plot


SSN documentation built on March 7, 2023, 5:30 p.m.