importSSN | R Documentation |
The importSSN
function reads spatial data from a .ssn folder and to
create a SpatialStreamNetwork object
importSSN(filepath, predpts = NULL, o.write = FALSE)
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 |
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.
importSSN
returns an object of class SpatialStreamNetwork
.
It also creates and stores a SQLite database, binaryID.db, within the .ssn
directory.
Erin E. Peterson support@SpatialStreamNetworks.com
Peterson E.E.(2011)STARS: Spatial Tools for the Analysis of River Systems: A tutorial. CSIRO Technical Report EP111313. 42p.
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.
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
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.