Skip to contents

This function prepares the raw (verbatim) coordinate information and if necessary, converts coordinates from 'degrees minutes seconds' or 'degrees decimal minutes' to 'decimal degrees' using the R package parzer. Where longitude and latitude are provided in decimal degrees, this function will round these to a maximum of seven decimal places.

Usage

dwc_coordinates(longitude, latitude, verbatimCoordinateSystem, verbatimSRS)

Arguments

longitude

The longitude of the given coordinates This will be assigned to verbatimLongitude in the returned tibble. Accepted formats are "decimal degrees", "degrees decimal minutes" and "degrees minutes seconds" Must be a character value if the coordinates are in degrees decimal minutes or degrees minutes seconds.

latitude

The latitude of the given coordinates This will be assigned to verbatimLatitude in the returned tibble. Accepted formats are "decimal degrees", "degrees decimal minutes" and "degrees minutes seconds" Must be a character value if the coordinates are in degrees decimal minutes or degrees minutes seconds.

verbatimCoordinateSystem

The format of the longitude and latitude coordinates. Supported terms are "decimal degrees", "degrees decimal minutes" or "degrees minutes seconds". See: http://rs.tdwg.org/dwc/terms/verbatimCoordinateSystem

verbatimSRS

The spatial reference system associated with the coordinates, given as an EPSG code as in the example: "EPSG:4326". See: http://rs.tdwg.org/dwc/terms/verbatimSRS.

Examples

data("thylacine_data")
thylacine_data |>
  dplyr::mutate(
    dwc_coordinates(
      longitude = longitude_dms,
      latitude = latitude_dms,
      verbatimCoordinateSystem = "degrees minutes seconds",
      verbatimSRS = "EPSG:4326"
    )
  )
#> # A tibble: 8 × 20
#>   site   trap     date_trap_setup   date_trap_collected longitude_dd latitude_dd
#>   <chr>  <chr>    <chr>             <chr>                      <dbl>       <dbl>
#> 1 Sumac  Sumac 1  05/09/2022 10:32… 06/09/2022 12:24:00         145.       -41.2
#> 2 Sumac  Sumac 2  05/09/2022 12:15… 06/09/2022 14:57:00         145.       -41.2
#> 3 Sumac  Sumac 1  05/10/2022 08:23… 06/10/2022 0:00:00          145.       -41.2
#> 4 Sumac  Sumac 2  05/10/2022 10:14… 06/10/2022 10:29:00         145.       -41.2
#> 5 Picton Picton 1 10/09/2022 10:32… 11/09/2022 12:24:00         147.       -43.3
#> 6 Picton Picton 2 10/09/2022 12:15… 11/09/2022 14:57:00         147.       -43.2
#> 7 Picton Picton 1 10/10/2022 0:00:… 11/10/2022 08:46:00         147.       -43.3
#> 8 Picton Picton 2 10/10/2022 10:14… 11/10/2022 10:29:00         147.       -43.2
#> # ℹ 14 more variables: longitude_dms <chr>, latitude_dms <chr>,
#> #   longitude_ddm <chr>, latitude_ddm <chr>, gps_uncertainty <dbl>,
#> #   species <chr>, count <dbl>, decimalLatitude <dbl>, decimalLongitude <dbl>,
#> #   geodeticDatum <chr>, verbatimLatitude <chr>, verbatimLongitude <chr>,
#> #   verbatimCoordinateSystem <chr>, verbatimSRS <chr>