write.stream: Function to write streams to a shapefile.

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

View source: R/write.stream.R

Description

This function creates and writes a shapefile object from traced streams. If present, further stream metadata will be exported as shapefile attributes as well.

Usage

1
write.stream(stream, filename, segments = FALSE, projection)

Arguments

stream

(list object) Stream object to be exported. This must be a list object of only one timestep from trace.stream. See examples for how to extract such a list structure.

filename

(character scalar) Name of the output file, with extension.

segments

(logical) Option to create stream individual segments (all lines between nodes as separate objects) or merged objects (all lines between nodes as one stream object), default is FALSE.

projection

The geographic projection of the output file. If not specified, the exported data set will not have any reference.

Value

A shapefile with stream courses and thematic stream data.

Author(s)

Michael Dietze

References

CSDMS website. http://csdms.colorado.edu/wiki/Model:CHILD.
Tucker, GE. 2010. CHILD Users Guide for version R9.4.1. http://csdms.colorado.edu/mediawiki/images/Child_users_guide.pdf
Tucker, GE., Lancaster, ST., Gasparini, NM., Bras, RL. 2001. The Channel-Hillslope Integrated Landscape Development (CHILD) Model. In Harmon, RS., Doe, W.W. III (eds). Landscape Erosion and Evolution Modeling. Kluwer Academic/Plenum Publishers, pp. 349-388.

See Also

write.raster, trace.stream

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
# load example data set
data(hillslope1)

# trace two streams from different starting points through two time steps
startpoints <- cbind(c(50, 100), c(120, 100))
streams <- trace.stream(dataset = hillslope1, 
                        timestep = 2:3, 
                        startpoints = startpoints)

# extract the first time step as source data for shapefile export
streams_export <- streams[[1]]

# write the streams into a shapefile and save it
write.stream(stream = streams_export, 
             filename = "streams.shp", 
             segments = TRUE,
             projection = "+proj=lcc +lat_1=48 +lat_2=33 +lon_0=-100 +ellps=WGS84")

coffeemuggler/RCHILD documentation built on Dec. 31, 2020, 10:05 p.m.