R/get_raster.R
get_raster.Rd
Base function to get raster from API and convert response to data frame
get_raster(
spatial_resolution = NULL,
temporal_resolution = NULL,
start_date = "2023-01-01",
end_date = "2023-12-31",
region_source = NULL,
region = NULL,
group_by = NULL,
filter_by = NULL,
key = gfw_auth(),
print_request = FALSE
)
Raster spatial resolution. Can be "LOW" = 0.1 degree or "HIGH" = 0.01 degree
Raster temporal resolution. Can be 'HOURLY', 'DAILY', 'MONTHLY', 'YEARLY'
Required. Start of date range to search events, in YYYY-MM-DD format and including this date
Required. End of date range to search events, in YYYY-MM-DD format and excluding this date
Source of the region ('EEZ','MPA', 'RFMO' or 'USER_SHAPEFILE'). Null by default but required if a value for region is specified.
If region_source
is set to "EEZ", "MPA" or "RFMO", GFW region
code (see get_region_id()
) if region_source = "USER_SHAPEFILE"
, sf
shapefile with the area of interest.
Parameter to group by. Can be 'VESSEL_ID', 'FLAG', 'GEARTYPE', 'FLAGANDGEARTYPE' or 'MMSI'. Optional.
Fields to filter AIS-based fishing effort after
group_by
. Possible options are flag
, geartype
and vessel_id
. You can
aggregate results using group_by
, for example group_by = 'FLAG'
, and then
filter results using filter_by = "flag IN ('ESP')"
.
Authorization token. Can be obtained with gfw_auth()
function
Boolean. Whether to print the request, for debugging purposes. When contacting the GFW team it will be useful to send this string
if (FALSE) { # \dontrun{
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)
} # }