Skip to contents

This function queries a PostgreSQL inventory database to return a list of forest plots or individuals, with options to include associated traits and metadata, and to generate interactive maps.

Usage

query_plots(
  plot_name = NULL,
  tag = NULL,
  country = NULL,
  locality_name = NULL,
  method = NULL,
  extract_individuals = FALSE,
  map = FALSE,
  id_individual = NULL,
  id_plot = NULL,
  id_tax = NULL,
  id_specimen = NULL,
  show_multiple_census = FALSE,
  show_all_coordinates = FALSE,
  remove_ids = TRUE,
  collapse_multiple_val = FALSE,
  extract_traits = TRUE,
  extract_individual_features = TRUE,
  traits_to_genera = FALSE,
  wd_fam_level = FALSE,
  include_liana = FALSE,
  extract_subplot_features = TRUE,
  concatenate_stem = FALSE,
  remove_obs_with_issue = TRUE,
  include_issue = FALSE,
  include_measurement_ids = FALSE,
  output_style = c("auto", "minimal", "standard", "permanent_plot", "transect", "full")
)

Arguments

plot_name

Optional. A single string specifying plot name.

tag

Optional. Tag identifier.

country

Optional. A single string specifying country.

locality_name

Optional. A single string specifying locality name.

method

Optional. Method identifier.

extract_individuals

Logical. Whether to extract individuals. Optional.

map

Logical. Whether to generate map. Optional.

id_individual

Optional. Individual identifiers.

id_plot

Optional. Plot identifiers.

id_tax

Optional. Taxonomic identifiers.

id_specimen

Optional. Specimen identifiers.

show_multiple_census

Logical. Whether to show multiple census data. Optional.

show_all_coordinates

Logical. Whether to show all coordinates. Optional.

remove_ids

Logical. Whether to remove ID columns from output. Optional.

collapse_multiple_val

Logical. Whether to collapse multiple values. Optional.

extract_traits

Logical. Whether to extract taxonomic traits. Optional.

extract_individual_features

Logical. Whether to extract individual-level features. Optional.

traits_to_genera

Logical. Whether to aggregate traits to genus level. Optional.

wd_fam_level

Logical. Whether to use family-level wood density. Optional.

include_liana

Logical. Whether to include lianas. Optional.

extract_subplot_features

Logical. Whether to extract subplot features. Optional.

concatenate_stem

Logical. Whether to concatenate multiple stems. Optional.

remove_obs_with_issue

Logical. Whether to remove observations with issues. Optional.

Value

A list or data frame containing plot data and associated information. When multiple components are requested, returns a list with elements like `extract`, `census_features`, `coordinates`, and `coordinates_sf`. If only one component is available, returns that component directly. Returns `NA` if no plots are found matching the criteria.

Examples

if (FALSE) { # \dontrun{
  query_plots(country = "Gabon", extract_individuals = FALSE)
  
  query_plots(country = "Cameroon")
  
  query_plots(plot_name = "mbalmayo001")
} # }