importPredpts: Import Prediction Points into a SpatialStreamNetwork or...

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/importPredpts.R

Description

Prediction points residing in a .ssn directory are imported into an existing object of class SpatialStreamNetwork-class or glmssn-class

Usage

1
importPredpts(target, predpts, obj.type)

Arguments

target

a SpatialStreamNetwork-class or glmssn-class object

predpts

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 SpatialStreamNetwork object

obj.type

the class of the target. For a SpatialStreamNetwork object, target = "ssn". For a glmssn-class object, target = "glm"

Details

importPredpts imports a shapefile of prediction points residing in the .ssn directory into an existing SpatialStreamnetwork or glmssn-class object. The spatial datasets residing the .ssn folder are 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).

Value

importPredpts returns an object of class "SpatialStreamNetwork" or "glmssn". An additional predpoints slot is populated in the object

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

importSSN, SpatialStreamNetwork-class, and glmssn-class

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
library(SSN)
#for examples, copy MiddleFork04.ssn directory to R's temporary directory
copyLSN2temp()
# NOT RUN
# Create a SpatialStreamNetork object that also contains prediction sites
#mf04 <- importSSN(paste0(tempdir(),'/MiddleFork04.ssn', o.write = TRUE))
#use mf04 SpatialStreamNetwork object, already created
data(mf04)
#for examples only, make sure mf04p has the correct path
#if you use importSSN(), path will be correct
mf04 <- updatePath(mf04, paste0(tempdir(),'/MiddleFork04.ssn'))

mf04p <- mf04
# add existing prediction points on 1 km spacing
mf04p <- importPredpts(target = mf04p, predpts = "pred1km", obj.type = "ssn")
# get names and verify that pred1km has been added
names(mf04p)    
 
# add dense set of prediction points from Knapp stream
mf04p <- importPredpts(target = mf04p, predpts = "Knapp", obj.type = "ssn")
# get names and verify that Knapp has been added
names(mf04p)    

# add dense set of prediction points from CapeHorn stream
mf04p <- importPredpts(target = mf04p, predpts = "CapeHorn", obj.type = "ssn")
# get names and verify that CapeHorn has been added
names(mf04p)   
 
# create distance matrices, needed for prediction with stream network models
# NOT RUN
#createDistMat(mf04p, "pred1km", o.write = TRUE)
# for block prediction, we need distance among prediction points
#createDistMat(mf04p, "Knapp", o.write = TRUE, amongpreds = TRUE)
#createDistMat(mf04p, "CapeHorn", o.write = TRUE)

# Add prediction points to a glmssn object
# use models that have been created already
data(modelFits)
#for examples only, make sure fitSp has the correct path
#if you use importSSN(), path will be correct
fitSp$ssn.object <- updatePath(fitSp$ssn.object, 
	paste0(tempdir(),'/MiddleFork04.ssn'))

#use model named fitSp; NOT RUN; already imported
#fitSp <- importPredpts(target = fitSp, predpts = "pred1km", 
#  obj.type = "glm")
# now we can make predictions; make sure distance matrix for "pred1km" has
# been created
# NOT RUN
#fitSpPred <- predict(fitSp,"pred1km")
#plot(fitSpPred)
#fitSp <- importPredpts(target = fitSp, predpts = "Knapp", 
#  obj.type = "glm")
# NOT RUN
#fitSpPredKnapp <- predict(fitSp,"Knapp")
#plot(fitSpPredKnapp)

SSN documentation built on March 13, 2020, 1:49 a.m.