Query LimnoTrack database with flexible parameters
lt_fetch.RdQuery any table in the LimnoTrack database with optional parameters for selecting columns, filtering rows, ordering results, and pagination. Automatically detects geometry columns and returns an sf::sf object if present, or a tibble::tibble otherwise.
Usage
lt_fetch(
table,
select = NULL,
filter = NULL,
order = NULL,
limit = 1000L,
offset = 0L,
base_url = "https://api.limnotrack.com/postgrest"
)Arguments
- table
character; name of the table to query (e.g.,
"lake_contours").- select
character; comma-separated column names to select (e.g.,
"col1,col2"). IfNULL, all columns are returned.- filter
named list of PostgREST filter expressions, typically built with
lt_filter()(e.g.,lt_filter(lernzmp_id == "LID40188")).- order
character; column ordering (e.g.,
"col1.asc,col2.desc").- limit
integer; maximum number of records to return. Default
1000.- offset
integer; number of records to skip for pagination. Default
0.- base_url
character; base URL of the LimnoTrack PostgREST API.
Value
A tibble::tibble, or an sf::sf object if the table contains geometry data.
Errors
ltapi_api_unavailableThe API could not be reached, or returned a 502/503/504.
ltapi_api_errorThe API returned an unexpected HTTP error.
Examples
if (FALSE) { # \dontrun{
lt_fetch(
table = "lake_contours",
filter = lt_filter(lernzmp_id == "LID40188")
)
} # }