View source: R/prep_reach_dist.R
prep_reach_dist | R Documentation |
Calculate the distance from a well to each reach within a stream network. This function splits a polyline stream network up into a series of evenly spaced points and calculates the distance from each of those points to a well.
prep_reach_dist(
wel_lon,
wel_lat,
stream_shp,
reach_id,
stream_pt_spacing,
buffer_width = 0.1,
nseed = 1
)
wel_lon |
longitude of well |
wel_lat |
latitude of well |
stream_shp |
shapefile of stream reaches |
reach_id |
string indicating name of column in |
stream_pt_spacing |
distance between points used for sampling each stream reach. The actual distance between points will be close to this (but not necessarily exact) due to sampling rounding error. The finer spacing you use, the more accurate your results will be but the function will run slower and use more memory. |
buffer_width |
width of buffer around stream used to match points with polylines |
nseed |
seed for random number generator (this is used to convert stream polylines to points) |
A data frame with four columns:
a grouping variable with the name of each stream reach
distance of a point on that stream reach to the well of interest
latitude of that point
longitude of that point
This data frame can be plugged directly into apportion_inverse, apportion_polygon (if latlon=T
),
or apportion_web
rdll <- prep_reach_dist(wel_lon = 295500, wel_lat = 4783200,
stream_shp = stream_lines, reach_id = "reach", stream_pt_spacing = 1)
head(rdll)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.