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.
File path, default is the current working directory.
Name of the shapefile, without the .shp extension.
The river network object to use.
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.
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.
1 2 3 4 5 6 7 8
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.