Package 'fdisf'

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

Help Index


add_vertices

Description

Densify a spatial polygon by adding vertices

Usage

add_vertices(sf, each = 0.1, parallel = FALSE, ...)

Arguments

sf

an object of class sf

each

the step value to use to create vertices

parallel

run in parallel

...

parallel options

Value

an object of class sf

Author(s)

Emmanuel Blondel [email protected]


bbox_to_sf

Description

Creates a sf object out of a bounding box

Usage

bbox_to_sf(xmin, ymin, xmax, ymax, crs = 4326)

Arguments

xmin

xmin

ymin

ymin

xmax

xmax

ymax

ymax

crs

Defaut is 4326

Value

an object of class sf

Author(s)

Emmanuel Blondel [email protected]


bearing_between_vertices

Description

Calculates the bearing between each pair of coordinate. The bearing is computed with the bearingRhumb function.

Usage

bearing_between_vertices(features)

Arguments

features

an object of class sf

Value

an object of class data.frame including vertices indexes and the bearing

Author(s)

Emmanuel Blondel [email protected]


center_from_grid_code

Description

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)

Usage

center_from_grid_code(grid_code)

Arguments

grid_code

A grid code

Value

A named vector containing the center latitude (y) and longitude (x) plus the grid width (size_lat) and height (size_lon) in degrees

Examples

center_from_grid_code("5206066")
center_from_grid_code("6205065")

convert_CWP_grid

Description

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

Usage

convert_CWP_grid(grid_code, target_grid_type_code = grid_1x1)

Arguments

grid_code

A CWP grid code

target_grid_type_code

The type of CWP grid (one among grid_1x1, grid_5x5, grid_10x10, grid_10x20, grid_20x20 and grid_30x30)

Value

The CWP grid code for the grid of type grid_type_code that contains the main corner of the original grid

Examples

convert_CWP_grid("5201123", grid_5x5)
convert_CWP_grid("6205125", grid_1x1)

convert_to_CWP_grid

Description

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

Usage

convert_to_CWP_grid(lon, lat, grid_type_code = grid_5x5)

Arguments

lon

Longitude (decimal coordinates)

lat

Latitude (decimal coordinates)

grid_type_code

The type of CWP grid (one among grid_1x1, grid_5x5, grid_10x10, grid_10x20, grid_20x20 and grid_30x30)

Value

The CWP grid code for the provided coordinates and grid type

Examples

convert_to_CWP_grid(20, -10, grid_1x1)

create_cwp_grid

Description

Creates a CWP grid spatial object

Usage

create_cwp_grid(
  size = NULL,
  res = NULL,
  xmin = NULL,
  ymin = NULL,
  xmax = NULL,
  ymax = NULL,
  densify = FALSE,
  parallel = FALSE,
  ...
)

Arguments

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

Value

an object of class sf

Author(s)

Emmanuel Blondel [email protected]

References

CWP Handbook - https://www.fao.org/cwp-on-fishery-statistics/handbook/general-concepts/main-water-areas/fr/#c737133


create_geodesic_buffer

Description

Creates a geodesic buffer

Usage

create_geodesic_buffer(
  features,
  distance,
  unit = c("m", "nm"),
  n_segments = 72
)

Arguments

features

an object of class sf

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).

Value

an object of class sf

Author(s)

Emmanuel Blondel [email protected]


create_loxodrome_line

Description

Creates a loxodrome line from a straight line

Usage

create_loxodrome_line(features, distance = 1852)

Arguments

features

an lines object of class sf

distance

distance in meters. Default is 1852 (1 nautical mile)

Value

an object of class sf

Author(s)

Emmanuel Blondel [email protected]


CWP_to_grid_coordinates

Description

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)

Usage

CWP_to_grid_coordinates(grid_code)

Arguments

grid_code

A CWP grid code

Value

a data table containing the coordinates (LAT, LON) of each of the four boundary points for the grid

Examples

CWP_to_grid_coordinates("5201123")
CWP_to_grid_coordinates("6205125")

distance_between_vertices

Description

Calculates the distance between each pair of coordinate. The distance is computed with the distGeo function.

Usage

distance_between_vertices(features)

Arguments

features

an object of class sf

Value

an object of class data.frame including vertices indexes and the distance

Author(s)

Emmanuel Blondel [email protected]


Spatial features for fisheries data interoperability

Description

fdisf provides a set of spatial features for fisheries data interoperability

Author(s)

Emmanuel Blondel [email protected]

See Also

Useful links:


A constant representing the code for a 10x10 regular grid

Description

A constant representing the code for a 10x10 regular grid

Usage

grid_10x10

Format

An object of class numeric of length 1.

See Also

grid_code_10x10


A constant representing the code for a 10x20 regular grid

Description

A constant representing the code for a 10x20 regular grid

Usage

grid_10x20

Format

An object of class numeric of length 1.

See Also

grid_code_10x20


A constant representing the code for a 1x1 regular grid

Description

A constant representing the code for a 1x1 regular grid

Usage

grid_1x1

Format

An object of class numeric of length 1.

See Also

grid_code_1x1


A constant representing the code for a 20x20 regular grid

Description

A constant representing the code for a 20x20 regular grid

Usage

grid_20x20

Format

An object of class numeric of length 1.

See Also

grid_code_20x20


A constant representing the code for a 30x30 regular grid

Description

A constant representing the code for a 30x30 regular grid

Usage

grid_30x30

Format

An object of class numeric of length 1.

See Also

grid_code_30x30


A constant representing the code for a 5x5 regular grid

Description

A constant representing the code for a 5x5 regular grid

Usage

grid_5x5

Format

An object of class numeric of length 1.

See Also

grid_code_5x5


The list of all constants representing the codes for the various grids

Description

The list of all constants representing the codes for the various grids

Usage

grid_ALL

Format

An object of class numeric of length 6.


A constant representing the initial character of a 10x10 regular grid code

Description

A constant representing the initial character of a 10x10 regular grid code

Usage

grid_char_10x10

Format

An object of class character of length 1.


A constant representing the initial character of a 10x20 regular grid code

Description

A constant representing the initial character of a 10x20 regular grid code

Usage

grid_char_10x20

Format

An object of class character of length 1.


A constant representing the initial character of a 1x1 regular grid code

Description

A constant representing the initial character of a 1x1 regular grid code

Usage

grid_char_1x1

Format

An object of class character of length 1.


A constant representing the initial character of a 20x20 regular grid code

Description

A constant representing the initial character of a 20x20 regular grid code

Usage

grid_char_20x20

Format

An object of class character of length 1.


A constant representing the initial character of a 30x30 regular grid code

Description

A constant representing the initial character of a 30x30 regular grid code

Usage

grid_char_30x30

Format

An object of class character of length 1.


A constant representing the initial character of a 5x5 regular grid code

Description

A constant representing the initial character of a 5x5 regular grid code

Usage

grid_char_5x5

Format

An object of class character of length 1.


The list of all constants representing the initial character for the various regular grid codes

Description

The list of all constants representing the initial character for the various regular grid codes

Usage

grid_chars_ALL

Format

An object of class character of length 6.


A constant representing the code for a 10x10 regular grid

Description

A constant representing the code for a 10x10 regular grid

Usage

grid_code_10x10

Format

An object of class numeric of length 1.

See Also

grid_10x10


A constant representing the code for a 10x20 regular grid

Description

A constant representing the code for a 10x20 regular grid

Usage

grid_code_10x20

Format

An object of class numeric of length 1.

See Also

grid_10x20


A constant representing the code for a 1x1 regular grid

Description

A constant representing the code for a 1x1 regular grid

Usage

grid_code_1x1

Format

An object of class numeric of length 1.

See Also

grid_1x1


A constant representing the code for a 20x20 regular grid

Description

A constant representing the code for a 20x20 regular grid

Usage

grid_code_20x20

Format

An object of class numeric of length 1.

See Also

grid_20x20


A constant representing the code for a 30x30 regular grid

Description

A constant representing the code for a 30x30 regular grid

Usage

grid_code_30x30

Format

An object of class numeric of length 1.

See Also

grid_30x30


A constant representing the code for a 5x5 regular grid

Description

A constant representing the code for a 5x5 regular grid

Usage

grid_code_5x5

Format

An object of class numeric of length 1.

See Also

grid_5x5


A constant representing the code for an irregular grid

Description

A constant representing the code for an irregular grid

Usage

grid_code_irregular

Format

An object of class numeric of length 1.

See Also

grid_irregular


The list of all constants representing the codes for the various grids

Description

The list of all constants representing the codes for the various grids

Usage

grid_codes_ALL

Format

An object of class numeric of length 6.


A constant representing the code for an irregular grid

Description

A constant representing the code for an irregular grid

Usage

grid_irregular

Format

An object of class numeric of length 1.

See Also

grid_code_irregular


optimize_bbox

Description

Creates an optimized bbox for an sf object. The optimization consists in extending the bounding box to manage features crossing the dateline.

Usage

optimize_bbox(sf)

Arguments

sf

object of class sf

Value

an object of class bbox

Author(s)

Emmanuel Blondel [email protected]