Skip to contents

Builds, for each country, an all-time H3 fishing-effort layer broken down by gear class and uploads it to cloud storage as a zipped ESRI Shapefile bundle (the shapefile set plus a plain-text data dictionary). Intended for partners who consume GIS files rather than the web JSON exports from export_pds_spatial().

Usage

export_effort_gear_shapefiles(
  h3_res = 9L,
  countries = NULL,
  log_threshold = logger::DEBUG,
  package = "coasts"
)

Arguments

h3_res

Integer. H3 resolution of the effort grid to export. Default 9L.

countries

Optional character vector of country names to export. When NULL (default) every country present in the grid is exported, except the "unknown" bucket (trips with no device metadata).

log_threshold

Logging threshold. Default logger::DEBUG.

package

Name of the package whose inst/conf.yml to read. Defaults to "coasts".

Value

Invisibly, a character vector of the uploaded .zip object names (or NULL if the grid was unavailable or lacked the gear/country columns).

Details

Reads the gear/country-partitioned H3 effort grid (predicted-pds-h3_grid_r{h3_res}) produced by aggregate_pds_effort(). For each country it:

  1. Collapses the per-year rows to one row per (h3_index, gear), summing fishing_hours and unique_trips and taking the union of active_dates for an exact active-day count (so hrs_day is correct across years).

  2. Attaches H3 hexagon polygons via create_spatial_grid().

  3. Renames columns to <=10-character names (the ESRI Shapefile DBF limit).

  4. Writes the shapefile set and a README.txt data dictionary, zips them, and uploads a versioned .zip to the coasts bucket.

Shapefile fields: h3_id, gear_class, fish_hrs (total fishing hours), trips (unique trips), n_days (active days), hrs_day (fishing hours per active day).