Latitude-longitude to c-square converter.

latitude_longitude_to_csquare(
  data,
  grid_square,
  latitude_name,
  longitude_name,
  boundary_ajustement_factor = 1e-06
)

Arguments

data

R data with at least two columns with longitude and latitude values. Be careful! Your longitude and latitude data have to be in the WGS84 projection and coordinates in decimal degree.

grid_square

numeric expected. Resolution for the global grid square. You have just to provide the first value of the resolution. Check the section details below.

latitude_name

character expected. Latitude column name in your data.

longitude_name

character expected. Longitude column name in your data.

boundary_ajustement_factor

numeric expected. By default 0.000001. Boundary adjustment factor is invoked for latitude values -90/90, longitude values -180/180, i.e. the limiting cases. The value does not matter unduly, so long as it is smaller than the size of the smallest square that will be requested.

Value

The function return your input data frame with one more columns filled with the c-square value (according your specification in the "grid_square" argument).

Details

For the argument "grid_square", you can choose between 7 modalities:

  • 10: for a grid with a resolution of 10x10 degrees

  • 5: for a grid with a resolution of 5x5 degrees

  • 1: for a grid with a resolution of 1x1 degrees

  • 0.5: for a grid with a resolution of 0.5x0.5 degrees

  • 0.1: for a grid with a resolution of 0.1x0.1 degrees

  • 0.05: for a grid with a resolution of 0.05x0.05 degrees

  • 0.01: for a grid with a resolution of 0.01x0.01 degrees

This function have been developped regarding a MS Excel worksheet of Tony Rees (Tony.Rees@csiro.au). If you want more informations about C-square visit http://www.cmar.csiro.au/csquares/spec1-1.htm.

Examples

# Example for classification until division fao fishing area
if (FALSE) {
tmp <- latitude_longitude_to_csquare(data = balbaya_landing_rectangle,
                           grid_square = 0.5,
                           latitude_name = "latitude",
                           longitude_name = "longitude")}