Base function to get raster from API and convert response to data frame

get_raster(
  spatial_resolution = NULL,
  temporal_resolution = NULL,
  group_by = NULL,
  filter_by = NULL,
  start_date = NULL,
  end_date = NULL,
  region = NULL,
  region_source = NULL,
  key = gfw_auth(),
  print_request = FALSE
)

Arguments

spatial_resolution

raster spatial resolution. Can be "LOW" = 0.1 degree or "HIGH" = 0.01 degree

temporal_resolution

raster temporal resolution. Can be 'HOURLY', 'DAILY', 'MONTHLY', 'YEARLY'

group_by

parameter to group by. Can be 'VESSEL_ID', 'FLAG', 'GEARTYPE', 'FLAGANDGEARTYPE' or 'MMSI'. Optional.

filter_by

parameter to filter by.

start_date

Start of date range to search events, in YYYY-MM-DD format and including this date

end_date

End of date range to search events, in YYYY-MM-DD format and excluding this date

region

sf shape to filter raster or GFW region code (such as a Marine Regions Geographic Identifier or EEZ code).

region_source

source of the region ('EEZ','MPA', 'RFMO' or 'USER_SHAPEFILE')

key

Authorization token. Can be obtained with gfw_auth() function

print_request

Boolean. Whether to print the request, for debugging purposes. When contacting the GFW team it will be useful to send this string

Examples

if (FALSE) {
library(gfwr)
# using region codes
code_eez <- get_region_id(region_name = 'CIV', region_source = 'EEZ',
key = gfw_auth())
get_raster(spatial_resolution = 'LOW',
           temporal_resolution = 'YEARLY',
           group_by = 'FLAG',
           start_date = "2021-01-01",
           end_date = "2021-10-01",
           region = code_eez$id,
           region_source = 'EEZ',
           key = gfw_auth(),
           print_request = TRUE)
#using a sf from disk /loading a test sf object
data(test_shape)
get_raster(spatial_resolution = 'LOW',
            temporal_resolution = 'YEARLY',
            start_date = '2021-01-01',
            end_date = '2021-10-01',
            region = test_shape,
            region_source = 'USER_SHAPEFILE',
            key = gfw_auth(),
            print_request = TRUE)
}