Skip to contents

This function takes a data frame with point locations in longitude and latitude and returns the Darwin Core Location fields decimalLatitude, decimalLongitude, geodeticDatum, coordinateUncertaintyInMeters, coordinatePrecision, verbatimLatitude, verbatimLongitude, verbatimCoordinateSystem, verbatimSRS and optionally country, countryCode, stateProvince, county and locality.The function is a wrapper for dwcPrepare functions dwc_coordinates, dwc_coordinatePrecision, dwc_coordinateUncertaintyInMeters, dwc_country_to_county and dwc_locality. The help pages of these functions have further details.

Usage

dwc_Location(
  longitude,
  latitude,
  verbatimCoordinateSystem,
  verbatimSRS,
  gps_uncertainty = 30,
  localities_sf = NULL,
  localities_names = NULL,
  county_sf = NULL
)

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.

gps_uncertainty

The uncertainty in meters recorded by the GPS device. Default is 30.

localities_sf

An optional sf POINT object that provides locality names as well as their longitude and latitude for all localities within the area of interest. The package includes the locality information for Australia. See locality_data_aus. If provided, the dwc_locality field will be returned. Default is NULL.

localities_names

The column name in localities_sf that gives the locality name. Given as a string.

county_sf

An optional sf POLYGON object that includes the county boundaries along with the higher geography features. Column names must match the Darwin Core terms country, countryCode, stateProvince and county. If provided, these Darwin Core terms will be returned for each location. Default is NULL.

Examples

library("dplyr")
#> 
#> Attaching package: ‘dplyr’
#> The following objects are masked from ‘package:stats’:
#> 
#>     filter, lag
#> The following objects are masked from ‘package:base’:
#> 
#>     intersect, setdiff, setequal, union

data("thylacine_data")
data("locality_data_aus")
data("county_tas")

thylacine_data |>
  mutate(dwc_Location(
    longitude = longitude_dd,
    latitude = latitude_dd,
    verbatimCoordinateSystem = "decimal degrees",
    verbatimSRS = "EPSG:4326",
    gps_uncertainty = gps_uncertainty,
    localities_sf = locality_data_aus,
    localities_names = "locality_name",
    county_sf = county_tas
  ))
#> The legacy packages maptools, rgdal, and rgeos, underpinning the sp package,
#> which was just loaded, will retire in October 2023.
#> Please refer to R-spatial evolution reports for details, especially
#> https://r-spatial.org/r/2023/05/15/evolution4.html.
#> It may be desirable to make the sf package available;
#> package maintainers should consider adding sf to Suggests:.
#> The sp package is now running under evolution status 2
#>      (status 2 uses the sf package in place of rgdal)
#> # A tibble: 8 × 27
#>   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
#> # ℹ 21 more variables: longitude_dms <chr>, latitude_dms <chr>,
#> #   longitude_ddm <chr>, latitude_ddm <chr>, gps_uncertainty <dbl>,
#> #   species <chr>, count <dbl>, country <chr>, countryCode <chr>,
#> #   stateProvince <chr>, county <chr>, locality <chr>, decimalLatitude <dbl>,
#> #   decimalLongitude <dbl>, geodeticDatum <chr>,
#> #   coordinateUncertaintyInMeters <dbl>, coordinatePrecision <dbl>,
#> #   verbatimLatitude <dbl>, verbatimLongitude <dbl>, …