R/logbook_eez_control.R
logbook_eez_control.Rd
The purpose of the logbook_eez_control function is to provide a table of data that contains an inconsistency between the fishing area declared and calculated with position for the activity fishing
logbook_eez_control(
dataframe1,
dataframe2,
output,
activity_crs = 4326,
international_waters_code = "XIN",
vessel_activity = c("6")
)
data.frame expected. Csv or output of the function data_extraction, which must be done before using the logbook_eez_control () function.
data.frame expected. Layer to containing the eez shapefile (example cf : Flanders Marine Institute (2023). Maritime Boundaries Geodatabase: Maritime Boundaries and Exclusive Economic Zones (200NM), version 12. Available online at https://www.marineregions.org/. https://doi.org/10.14284/632)
character expected. Kind of expected output. You can choose between "message", "report" or "logical".
numeric expected. Default values: 4326. Coordinate Reference Systems for the position activity
character expected. Default values: "XIN". iso3 code corresponding to international waters
character expected. Default values: c("6"). Vector of inventory of codes for activities that must have a zee zone
The function returns a character with output is "message", two data.frame with output is "report" (the first without geographical location and the second with geographical location), a logical with output is "logical"
The input dataframe must contain all these columns for the function to work :
activity_id
vesselactivity_code
fpazone_code
fpazone_country_iso3
activity_position
ISO_TER1
ISO_TER2
ISO_TER3
geometry
#Activity 1, 2, 3 and 5 are ok,
#Activity 4 is outside the EEZ delimited in the shapefile,
#Activity 6 has a missing EEZ zone and the vessel's activity is in vessel_activity,
#Activity 7 has different EEZ,
#Activity 8 has an EEZ zone unknown to the shapefile and which also does not exist in
# international_waters_code
dataframe1 <- data.frame(activity_id = c("1", "2", "3", "4", "5", "6", "7", "8"),
vesselactivity_code = c("6", "6", "6", "6", "1", "6", "6", "6"),
fpazone_code = c("SYC", "XSG", "XIN", "SYC", NA, NA, "AZE", "AZE"),
fpazone_country_iso3 = c("SYC", "XXX", "XIN", "SYC", NA, NA, "AZE", "AZE"),
activity_position = c("POINT (1 1)", "POINT (4 3)", "POINT (-1 -1)",
"POINT (-1 -1)", "POINT (1 1)", "POINT (1 1)",
"POINT (1 1)", "POINT (6 6)"))
dataframe2 <- sf::st_sf(data.frame(ISO_TER1 = c("SYC", "XSG"),
ISO_TER2 = c(NA, NA),
ISO_TER3 = c(NA, NA),
geometry = sf::st_sfc(sf::st_polygon(list(rbind(c(0,0), c(2,0),
c(2,2), c(0,2),
c(0,0)))),
sf::st_polygon(list(rbind(c(3,3), c(3,5),
c(5,5), c(5,3),
c(3,3)))),
crs = 4326)))
logbook_eez_control(dataframe1, dataframe2, output = "report")
#> [[1]]
#> activity_id vesselactivity_code fpazone_code fpazone_country_iso3
#> 1 1 6 SYC SYC
#> 2 2 6 XSG XXX
#> 3 3 6 XIN XIN
#> 4 4 6 SYC SYC
#> 5 5 1 <NA> <NA>
#> 6 6 6 <NA> <NA>
#> 7 7 6 AZE AZE
#> 8 8 6 AZE AZE
#> eez_calculated logical
#> 1 SYC TRUE
#> 2 XSG TRUE
#> 3 <NA> TRUE
#> 4 On land or in international waters FALSE
#> 5 <NA> TRUE
#> 6 <NA> FALSE
#> 7 SYC FALSE
#> 8 On land or in international waters FALSE
#>
#> [[2]]
#> activity_id vesselactivity_code fpazone_code fpazone_country_iso3
#> 1 1 6 SYC SYC
#> 2 2 6 XSG XXX
#> 3 3 6 XIN XIN
#> 4 4 6 SYC SYC
#> 5 5 1 <NA> <NA>
#> 6 6 6 <NA> <NA>
#> 7 7 6 AZE AZE
#> 8 8 6 AZE AZE
#> activity_position eez_calculated logical activity_crs
#> 1 POINT (1 1) SYC TRUE 4326
#> 2 POINT (4 3) XSG TRUE 4326
#> 3 POINT (-1 -1) <NA> TRUE 4326
#> 4 POINT (-1 -1) On land or in international waters FALSE 4326
#> 5 POINT (1 1) <NA> TRUE 4326
#> 6 POINT (1 1) <NA> FALSE 4326
#> 7 POINT (1 1) SYC FALSE 4326
#> 8 POINT (6 6) On land or in international waters FALSE 4326
#>