diff --git a/NEWS.md b/NEWS.md index 09ef2a3c..a2be07e9 100644 --- a/NEWS.md +++ b/NEWS.md @@ -2,6 +2,7 @@ nhdplusTools 0.3.16 ========== * `subset_nhdplus()` now validates geometry and ensures all outputs are in NAD83 * `subset_nhdplus()` queries the NHDPlus database rather than loading then filtering +* `get_levelpaths()` rewritten for performance. Package now uses `data.table`. nhdplusTools 0.3.15 ========== diff --git a/R/get_paths.R b/R/get_paths.R index 57389752..f868b38d 100644 --- a/R/get_paths.R +++ b/R/get_paths.R @@ -105,6 +105,7 @@ get_path <- function(x, tailID, status) { x <- data.table::data.table(x) } + toID <- NULL while(keep_going) { # May be more than 1 if(dt) { diff --git a/R/index_nhdplus.R b/R/index_nhdplus.R index e1c72e31..497b0a6e 100644 --- a/R/index_nhdplus.R +++ b/R/index_nhdplus.R @@ -68,6 +68,7 @@ matcher <- function(coords, points, search_radius, max_matches = 1) { #' @importFrom magrittr "%>%" #' @export #' @examples +#' \donttest{ #' sample_flines <- sf::read_sf(system.file("extdata", #' "petapsco_flowlines.gpkg", #' package = "nhdplusTools")) @@ -94,6 +95,7 @@ matcher <- function(coords, points, search_radius, max_matches = 1) { #' search_radius = 0.2, #' max_matches = 10) #' +#' } get_flowline_index <- function(flines, points, search_radius = 0.1, diff --git a/docs/news/index.html b/docs/news/index.html index 8438d429..8b2f70e0 100644 --- a/docs/news/index.html +++ b/docs/news/index.html @@ -152,6 +152,8 @@

subset_nhdplus() now validates geometry and ensures all outputs are in NAD83
  • subset_nhdplus() queries the NHDPlus database rather than loading then filtering
  • +
  • +get_levelpaths() rewritten for performance. Package now uses data.table.
  • diff --git a/docs/pkgdown.yml b/docs/pkgdown.yml index df3d2689..80d553a2 100644 --- a/docs/pkgdown.yml +++ b/docs/pkgdown.yml @@ -6,7 +6,7 @@ articles: nhdplusTools: nhdplusTools.html plot_nhdplus: plot_nhdplus.html point_indexing: point_indexing.html -last_built: 2020-11-05T01:06Z +last_built: 2020-11-13T16:32Z urls: reference: https://usgs-r.github.io/nhdplusTools//reference article: https://usgs-r.github.io/nhdplusTools//articles diff --git a/docs/reference/get_flowline_index.html b/docs/reference/get_flowline_index.html index 6d415ffe..388552c2 100644 --- a/docs/reference/get_flowline_index.html +++ b/docs/reference/get_flowline_index.html @@ -209,7 +209,8 @@

    Details handling of precision parameter.

    Examples

    -
    sample_flines <- sf::read_sf(system.file("extdata", +
    # \donttest{ +sample_flines <- sf::read_sf(system.file("extdata", "petapsco_flowlines.gpkg", package = "nhdplusTools")) get_flowline_index(sample_flines, @@ -229,7 +230,7 @@

    Examp get_flowline_index(sample_flines, sf::st_sfc(sf::st_point(c(-76.87479, 39.48233)), - crs = 4326), precision = 30)

    #> # A tibble: 1 x 5 + crs = 4326), precision = 30)
    #> Linking to GEOS 3.8.0, GDAL 3.0.4, PROJ 6.3.1
    #> # A tibble: 1 x 5 #> id COMID REACHCODE REACH_meas offset #> <int> <int> <chr> <dbl> <dbl> #> 1 1 11689978 02060003001472 52.3 0.0000458
    @@ -253,6 +254,7 @@

    Examp #> 9 1 11690490 02060003000580 0 0.00285 #> 10 3 11688948 02060003000516 0 0.00321 #> # ... with 20 more rows

    +# }