pointshp2segvert | R Documentation |
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.
pointshp2segvert(path = ".", layer, rivers)
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. |
A data frame of river locations, with segment numbers in
$seg
, vertex numbers in $vert
, snapping distances in
$snapdist
, snapped x- and y-coordinates in $snap_x
and $snap_y
,
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.
Matt Tyers
xy2segvert
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.