## ----include=FALSE------------------------------------------------------------
knitr::opts_chunk$set(collapse = TRUE, comment = "#>", fig.width = 6, fig.height = 4)
helper <- if (file.exists("vignettes/real-example-helpers.R")) {
  "vignettes/real-example-helpers.R"
} else {
  "real-example-helpers.R"
}
source(helper)
real_mode <- bt_real_examples_enabled()

## ----setup, include=FALSE, eval=bt_real_examples_enabled()--------------------
# real <- bt_real_example_setup()
# real_aoi <- real$aoi

## ----discover, eval=bt_real_examples_enabled()--------------------------------
# tiles <- bluertopo_tiles(
#   real_aoi,
#   resolution = "native",
#   coverage = "warn",
#   quiet = TRUE
# )

## ----selected-table, echo=FALSE, eval=bt_real_examples_enabled()--------------
# bt_display_table(bt_tile_table(tiles, include_urls = TRUE))

## ----coverage-table, echo=FALSE, eval=bt_real_examples_enabled()--------------
# coverage <- attr(tiles, "coverage")
# bt_display_table(bt_coverage_table(coverage))

## ----footprint-figure, echo=FALSE, eval=bt_real_examples_enabled(), fig.cap="BlueTopo tile coverage for the New York Harbor example area.", fig.alt="BlueTopo tile footprints selected for the New York Harbor example area."----
# bt_plot_locator_map(
#   tiles,
#   real_aoi,
#   place_label = real$place,
#   main = "New York Harbor AOI and BlueTopo tiles"
# )

## ----coverage-bars, echo=FALSE, eval=bt_real_examples_enabled(), fig.cap="Coverage fractions for the selected New York Harbor tiles.", fig.alt="Bar plot of published coverage, selected coverage, selected AOI fraction, and target coverage."----
# coverage_values <- unlist(coverage[c(
#   "published_coverage_fraction",
#   "selected_coverage_fraction",
#   "selected_aoi_fraction",
#   "target_coverage"
# )])
# barplot(
#   coverage_values,
#   ylim = c(0, 1),
#   col = c("#8ecae6", "#90be6d", "#f9c74f", "#d00000"),
#   las = 2,
#   ylab = "fraction",
#   main = "Coverage diagnostics"
# )
# abline(h = coverage$target_coverage, col = "#d00000", lwd = 2, lty = 2)

