Skip to content

Commit d0a35ae

Browse files
author
Mike Johnson
committed
fix(pkgdown,docs): unbreak site build; harden as_ogr; doc/debug fixes
* _pkgdown.yml: add exported get_streamorder and hf_check_merge_invariants to the reference index. They were exported in 0.3.4 but never indexed, so pkgdown::build_site_github_pages() aborted ("topics missing from index") and the Website workflow was failing on every push. * as_ogr.OGRSQLConnection(): on an ambiguous layer, cli_abort with the candidate list (matching read_hydrofabric) instead of print()ing and returning the bare connection; also abort on zero readable layers. * OGRSQLConnection dbSendQuery(): fix the ogr.query.debug message -- the sprintf had two placeholders but one arg and nrow() was passed to message() rather than sprintf(), so enabling debug errored. * Docstring fixes: complete the truncated lynker_spatial_auth `token` param; add_lengthkm "areas" -> "lengths"; get_hydroseq param referenced a nonexistent `topology` arg (-> x); OGRSQLResult \pkg{lazsf} -> \pkg{hfutils}; arrow_to_sf "metatdata" typo. * Regenerate favicons from the newer logo (resolves pkgdown sitrep).
1 parent b609f9a commit d0a35ae

18 files changed

Lines changed: 32 additions & 28 deletions

R/OGRSQLConnection.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,9 @@ setMethod("dbSendQuery", "OGRSQLConnection", function(conn, statement, ...) {
5353
message(
5454
sprintf(
5555
"-------------\nOGR debug ....\nSQL:\n%s\nnrows read:\n%i",
56-
statement
57-
),
58-
nrow(layer_data)
56+
statement,
57+
nrow(layer_data)
58+
)
5959
)
6060
}
6161
if (inherits(layer_data, "try-error")) {

R/OGRSQLResult.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#' OGRSQLResult objects are created by [dbSendQuery()] or [dbSendStatement()],
44
#' and encapsulate the result of an SQL statement.
55
#' They are a superclass of the [DBIResult-class] class.
6-
#' The "Usage" section lists the class methods overridden by \pkg{lazsf}.
6+
#' The "Usage" section lists the class methods overridden by \pkg{hfutils}.
77
#' @seealso
88
#' The corresponding generic functions
99
#' [DBI::dbFetch()], [DBI::dbClearResult()], and

R/auth.R

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#' Authenticate with Lynker Spatial
2-
#' @param token An existing OAuth2 token. If NULL, then a new token is provisioned and returned.
3-
#' If the token is expired, then
2+
#' @param token An existing OAuth2 token. If `NULL`, a new token is provisioned
3+
#' and returned. If the supplied token is expired, it is refreshed via
4+
#' [lynker_spatial_refresh()] before use.
45
#' @param ... Unused
56
#' @param libs Libraries to configure auth for; any of `"gdal"`, `"duckdb"`,
67
#' `"arrow"`. Default `c("gdal", "duckdb")`. `"arrow"` authenticates via the

R/network_properties.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,9 @@ accumulate_downstream <- function(x, id = "flowpath_id", toid = "flowpath_toid
9999
#'
100100
#' @param x A data frame (or tibble) containing at least the identifier column
101101
#' given by `id` and the downstream pointer column given by `toid`.
102-
#' @param id Character scalar. Column name in `topology` with unique node identifiers.
102+
#' @param id Character scalar. Column name in `x` with unique node identifiers.
103103
#' Defaults to `"flowpath_id"`.
104-
#' @param toid Character scalar. Column name in `topology` with the *downstream* node
104+
#' @param toid Character scalar. Column name in `x` with the *downstream* node
105105
#' identifier for each row. Use `NA` or `0` for outlets/terminals.
106106
#' Defaults to `"flowpath_toid"`.
107107
#'

R/sf_arrow.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ arrow_to_sf <- function(tbl, metadata) {
132132
primary_geom <- metadata$primary_column
133133

134134
if (length(geom_cols) < 1) {
135-
stop("Malformed file and geo metatdata.")
135+
stop("Malformed file and geo metadata.")
136136
}
137137
if (!primary_geom %in% geom_cols) {
138138
primary_geom <- geom_cols[1]

R/sf_ogr.R

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -89,20 +89,22 @@ as_ogr.OGRSQLConnection <- function(x, layer, ..., query = NA, ignore_lyrs = "gp
8989
tbls <- dbListTables(x)
9090
tbls <- tbls[!grepl(ignore_lyrs, tbls)]
9191

92-
if (length(tbls) == 1) {
92+
if (length(tbls) == 0L) {
93+
cli::cli_abort("No readable layers found in the data source.")
94+
} else if (length(tbls) == 1L) {
9395
layer <- tbls
9496
} else {
95-
layer <- NULL
96-
print(tbls)
97+
cli::cli_abort(c(
98+
"Multiple layers found; please specify {.arg layer} explicitly:",
99+
">" = paste(tbls, collapse = ", ")
100+
))
97101
}
98102
}
99103

100-
if (!is.null(layer)) {
101-
if (layer %in% dbListTables(x)) {
102-
x <- tbl(x, layer)
103-
} else {
104-
cli::cli_abort("{.val {layer}} not in gpkg.")
105-
}
104+
if (layer %in% dbListTables(x)) {
105+
x <- tbl(x, layer)
106+
} else {
107+
cli::cli_abort("{.val {layer}} not in gpkg.")
106108
}
107109

108110
x

R/utils.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ add_areasqkm <- function(x) {
158158
#' Safely compute linestring length in km and return a plain numeric vector.
159159
#'
160160
#' @param x An `sf` object with LINE* geometry. If `x` is not in a projected
161-
#' CRS, `sf::st_length()` will compute ellipsoidal areas when possible.
161+
#' CRS, `sf::st_length()` will compute ellipsoidal lengths when possible.
162162
#'
163163
#' @return A numeric vector of lengths in kilometers.
164164
#'

_pkgdown.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ reference:
111111
contents:
112112
- accumulate_downstream
113113
- get_hydroseq
114+
- get_streamorder
114115
- add_measures
115116
- add_areasqkm
116117
- add_lengthkm
@@ -126,6 +127,7 @@ reference:
126127
- gpkg_set_version
127128
- gpkg_get_version
128129
- hf_check_invariants
130+
- hf_check_merge_invariants
129131
- hf_check_attr_bounds
130132
- hf_attr_bounds
131133

man/OGRSQLResult-class.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/add_lengthkm.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)