pointshp2segvert: Convert a Point Shapefile to River Locations

Description Usage Arguments Value Note Author(s) Examples

View source: R/riverdist_1.R

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

1
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

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)

riverdist documentation built on Sept. 10, 2021, 9:06 a.m.