View source: R/index_nhdplus.R
| get_flowline_index | R Documentation |
given an sf point geometry column, return COMID, reachcode, and measure for each.
get_flowline_index(
flines,
points,
search_radius = NULL,
precision = NA,
max_matches = 1
)
flines |
sf data.frame of type LINESTRING or MULTILINESTRING including COMID, REACHCODE, ToMeas, and FromMeas. Can be "download_nhdplusv2" and remote nhdplusv2 data will be downloaded for the bounding box surround the submitted points. NOTE: The download option may not work for large areas, use with caution. |
points |
sf or sfc of type POINT in analysis projection. NOTE: flines will be projected to the projection of the points layer. |
search_radius |
units distance for the nearest neighbor search to extend in analysis projection. If missing or NULL, and points are in a lon lat projection, a default of 0.01 degree is used, otherwise 200 m is used. Conversion to the linear unit used by the provided crs of points is attempted. See RANN nn2 documentation for more details. |
precision |
numeric the resolution of measure precision in the output in meters. |
max_matches |
numeric the maximum number of matches to return if multiple are found in search_radius |
Note 1: Inputs are cast into LINESTRINGS. Because of this, the measure output of inputs that are true multipart lines may be in error.
Note 2: This algorithm finds the nearest node in the input flowlines to identify which flowline the point should belong to. As a second pass, it can calculate the measure to greater precision than the nearest flowline geometry node.
Note 3: Offset is returned in units consistent with the projection of the input points.
Note 4: See 'dfMaxLength' input to sf::st_segmentize() for details of handling of precision parameter.
Note 5: "from" is downstream – 0 is the outlet "to" is upstream – 100 is the inlet
data.frame with five columns, id, COMID, REACHCODE, REACH_meas, and offset. id is the row or list element in the point input.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.