pointshp2segvert {riverdist} | R Documentation |
Convert a Point Shapefile to River Locations
Description
This function reads a point shapefile and determines the closest vertex in the river network to each point of XY data, returning a data frame with river locations, defined as segment numbers and vertex numbers, along with the data table read from the input shapefile.
Usage
pointshp2segvert(path = ".", layer, rivers)
Arguments
path |
File path, default is the current working directory. |
layer |
Name of the shapefile, without the .shp extension. |
rivers |
The river network object to use. |
Value
A data frame of river locations, with segment numbers in
$seg
, vertex numbers in $vert
, snapping distances in
$snapdist
, and the remaining columns
corresponding to the data table in the input point shapefile.
Note
If the input shapefile is detected to be in a different projection than the river network, the input shapefile will be re-projected before conversion to river locations.
Author(s)
Matt Tyers
Examples
filepath <- system.file("extdata", package="riverdist")
fakefish_UTM5 <- pointshp2segvert(path=filepath, layer="fakefish_UTM5", rivers=Gulk)
head(fakefish_UTM5)
plot(x=Gulk)
points(fakefish_UTM5$x, fakefish_UTM5$y)
riverpoints(seg=fakefish_UTM5$seg, vert=fakefish_UTM5$vert, rivers=Gulk, pch=16, col=2)