| Title: | Spatial features for fisheries data interoperability |
|---|---|
| Description: | Spatial features for fisheries data interoperability |
| Authors: | Emmanuel Blondel [aut, cre] (ORCID: <https://orcid.org/0000-0002-5870-5762>), Arturo Muñoz Albero [ctb] |
| Maintainer: | Emmanuel Blondel <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.1.20260707 |
| Built: | 2026-07-10 10:12:25 UTC |
| Source: | https://github.com/fdiwg/fdisf |
Densify a spatial polygon by adding vertices
add_vertices(sf, each = 0.1, parallel = FALSE, ...)add_vertices(sf, each = 0.1, parallel = FALSE, ...)
sf |
an object of class |
each |
the step value to use to create vertices |
parallel |
run in parallel |
... |
parallel options |
an object of class sf
Emmanuel Blondel [email protected]
Creates a sf object out of a bounding box
bbox_to_sf(xmin, ymin, xmax, ymax, crs = 4326)bbox_to_sf(xmin, ymin, xmax, ymax, crs = 4326)
xmin |
xmin |
ymin |
ymin |
xmax |
xmax |
ymax |
ymax |
crs |
Defaut is 4326 |
an object of class sf
Emmanuel Blondel [email protected]
Calculates the bearing between each pair of coordinate. The bearing is computed with the bearingRhumb function.
bearing_between_vertices(features)bearing_between_vertices(features)
features |
an object of class |
an object of class data.frame including vertices indexes and the bearing
Emmanuel Blondel [email protected]
Function copied from iotc_core_gis_cwp_utils (https://github.com/iotc-secretariat/iotc-lib-core-gis-cwp/blob/master/R/iotc_core_gis_cwp_utils.R) Returns details about the center of a regular grid provided the grid code. Details include: the center latitude / longitude (regardless of the fraction of ocean area in the grid) the grid width and height (in degrees)
center_from_grid_code(grid_code)center_from_grid_code(grid_code)
grid_code |
A grid code |
A named vector containing the center latitude (y) and longitude (x) plus the grid
width (size_lat) and height (size_lon) in degrees
center_from_grid_code("5206066") center_from_grid_code("6205065")center_from_grid_code("5206066") center_from_grid_code("6205065")
Function copied from iotc_core_gis_cwp_utils (https://github.com/iotc-secretariat/iotc-lib-core-gis-cwp/blob/master/R/iotc_core_gis_cwp_utils.R) Converts a CWP grid code into another CWP grid code of a given type
convert_CWP_grid(grid_code, target_grid_type_code = grid_1x1)convert_CWP_grid(grid_code, target_grid_type_code = grid_1x1)
grid_code |
A CWP grid code |
target_grid_type_code |
The type of CWP grid (one among |
The CWP grid code for the grid of type grid_type_code that contains the main corner of the original grid
convert_CWP_grid("5201123", grid_5x5) convert_CWP_grid("6205125", grid_1x1)convert_CWP_grid("5201123", grid_5x5) convert_CWP_grid("6205125", grid_1x1)
Function copied from iotc_core_gis_cwp_utils (https://github.com/iotc-secretariat/iotc-lib-core-gis-cwp/blob/master/R/iotc_core_gis_cwp_utils.R) Converts a pair of decimal coordinate into a CWP grid code for a specific grid type
convert_to_CWP_grid(lon, lat, grid_type_code = grid_5x5)convert_to_CWP_grid(lon, lat, grid_type_code = grid_5x5)
lon |
Longitude (decimal coordinates) |
lat |
Latitude (decimal coordinates) |
grid_type_code |
The type of CWP grid (one among |
The CWP grid code for the provided coordinates and grid type
convert_to_CWP_grid(20, -10, grid_1x1)convert_to_CWP_grid(20, -10, grid_1x1)
Creates a CWP grid spatial object
create_cwp_grid( size = NULL, res = NULL, xmin = NULL, ymin = NULL, xmax = NULL, ymax = NULL, densify = FALSE, parallel = FALSE, ... )create_cwp_grid( size = NULL, res = NULL, xmin = NULL, ymin = NULL, xmax = NULL, ymax = NULL, densify = FALSE, parallel = FALSE, ... )
size |
an integer code corresponding to the grid size (referred as code A in the CWP Handbook) |
res |
a string matching one of the accepted resolution values. Accepted resolutions values are '10min_x_10min', '20min_x_20min', '30min_x_30min', '30min_x_1deg', '1deg_x_1deg', '5deg_x_5deg', '10deg_x_10deg', '20deg_x_20deg', '30deg_x_30deg'" |
xmin |
xmin of the output grid |
ymin |
ymin of the output grid |
xmax |
xmax of the output grid |
ymax |
ymax of the output grid |
densify |
densify |
parallel |
run in parallel |
... |
parallel options |
an object of class sf
Emmanuel Blondel [email protected]
CWP Handbook - https://www.fao.org/cwp-on-fishery-statistics/handbook/general-concepts/main-water-areas/fr/#c737133
Creates a geodesic buffer
create_geodesic_buffer( features, distance, unit = c("m", "nm"), n_segments = 72 )create_geodesic_buffer( features, distance, unit = c("m", "nm"), n_segments = 72 )
features |
an object of class |
distance |
distance |
unit |
unit for the distance (either 'm' for meters, or 'nm' for nautical miles) |
n_segments |
number of segments for each single vertex buffer (intermediate step). By default 72 which means a segment for each 5 degree bearing. For fine-grained buffers, values could be 180 (each 2 degree) or 360 (each degree). |
an object of class sf
Emmanuel Blondel [email protected]
Creates a loxodrome line from a straight line
create_loxodrome_line(features, distance = 1852)create_loxodrome_line(features, distance = 1852)
features |
an lines object of class |
distance |
distance in meters. Default is |
an object of class sf
Emmanuel Blondel [email protected]
Function copied from iotc_core_gis_cwp_utils (https://github.com/iotc-secretariat/iotc-lib-core-gis-cwp/blob/master/R/iotc_core_gis_cwp_utils.R) Converts a CWP grid code into its four boundary points (NW, NE, SW and SE)
CWP_to_grid_coordinates(grid_code)CWP_to_grid_coordinates(grid_code)
grid_code |
A CWP grid code |
a data table containing the coordinates (LAT, LON) of each of the four boundary points for the grid
CWP_to_grid_coordinates("5201123") CWP_to_grid_coordinates("6205125")CWP_to_grid_coordinates("5201123") CWP_to_grid_coordinates("6205125")
Calculates the distance between each pair of coordinate. The distance is computed with the distGeo function.
distance_between_vertices(features)distance_between_vertices(features)
features |
an object of class |
an object of class data.frame including vertices indexes and the distance
Emmanuel Blondel [email protected]
fdisf provides a set of spatial features for fisheries data interoperability
Emmanuel Blondel [email protected]
Useful links:
A constant representing the code for a 10x10 regular grid
grid_10x10grid_10x10
An object of class numeric of length 1.
grid_code_10x10
A constant representing the code for a 10x20 regular grid
grid_10x20grid_10x20
An object of class numeric of length 1.
grid_code_10x20
A constant representing the code for a 1x1 regular grid
grid_1x1grid_1x1
An object of class numeric of length 1.
grid_code_1x1
A constant representing the code for a 20x20 regular grid
grid_20x20grid_20x20
An object of class numeric of length 1.
grid_code_20x20
A constant representing the code for a 30x30 regular grid
grid_30x30grid_30x30
An object of class numeric of length 1.
grid_code_30x30
A constant representing the code for a 5x5 regular grid
grid_5x5grid_5x5
An object of class numeric of length 1.
grid_code_5x5
The list of all constants representing the codes for the various grids
grid_ALLgrid_ALL
An object of class numeric of length 6.
A constant representing the initial character of a 10x10 regular grid code
grid_char_10x10grid_char_10x10
An object of class character of length 1.
A constant representing the initial character of a 10x20 regular grid code
grid_char_10x20grid_char_10x20
An object of class character of length 1.
A constant representing the initial character of a 1x1 regular grid code
grid_char_1x1grid_char_1x1
An object of class character of length 1.
A constant representing the initial character of a 20x20 regular grid code
grid_char_20x20grid_char_20x20
An object of class character of length 1.
A constant representing the initial character of a 30x30 regular grid code
grid_char_30x30grid_char_30x30
An object of class character of length 1.
A constant representing the initial character of a 5x5 regular grid code
grid_char_5x5grid_char_5x5
An object of class character of length 1.
The list of all constants representing the initial character for the various regular grid codes
grid_chars_ALLgrid_chars_ALL
An object of class character of length 6.
A constant representing the code for a 10x10 regular grid
grid_code_10x10grid_code_10x10
An object of class numeric of length 1.
grid_10x10
A constant representing the code for a 10x20 regular grid
grid_code_10x20grid_code_10x20
An object of class numeric of length 1.
grid_10x20
A constant representing the code for a 1x1 regular grid
grid_code_1x1grid_code_1x1
An object of class numeric of length 1.
grid_1x1
A constant representing the code for a 20x20 regular grid
grid_code_20x20grid_code_20x20
An object of class numeric of length 1.
grid_20x20
A constant representing the code for a 30x30 regular grid
grid_code_30x30grid_code_30x30
An object of class numeric of length 1.
grid_30x30
A constant representing the code for a 5x5 regular grid
grid_code_5x5grid_code_5x5
An object of class numeric of length 1.
grid_5x5
A constant representing the code for an irregular grid
grid_code_irregulargrid_code_irregular
An object of class numeric of length 1.
grid_irregular
The list of all constants representing the codes for the various grids
grid_codes_ALLgrid_codes_ALL
An object of class numeric of length 6.
A constant representing the code for an irregular grid
grid_irregulargrid_irregular
An object of class numeric of length 1.
grid_code_irregular
Creates an optimized bbox for an sf object. The optimization consists in extending the bounding box to manage features crossing the dateline.
optimize_bbox(sf)optimize_bbox(sf)
sf |
object of class sf |
an object of class bbox
Emmanuel Blondel [email protected]