getTimezone: Return Olson timezones at specified locations

View source: R/getTimezone.R

getTimezoneR Documentation

Return Olson timezones at specified locations

Description

Uses spatial comparison to determine which timezone polygons the locations fall into and returns the Olson timezone strings for those polygons.

Specification of countryCodes limits spatial searching to the specified countries and greatly improves performance.

If allData=TRUE, additional data is returned.

Usage

getTimezone(
  longitude = NULL,
  latitude = NULL,
  datasetName = "SimpleTimezones",
  countryCodes = NULL,
  allData = FALSE,
  useBuffering = FALSE
)

Arguments

longitude

Vector of longitudes in decimal degrees East.

latitude

Vector of latitudes in decimal degrees North.

datasetName

Name of spatial dataset to use.

countryCodes

Vector of ISO 3166-1 alpha-2 country codes.

allData

Logical specifying whether a full dataframe should be returned.

useBuffering

Logical flag specifying the use of location buffering to find the nearest polygon if no target polygon is found.

Value

Vector of Olson timezones.

References

https://github.com/evansiroky/timezone-boundary-builder

Examples

library(MazamaSpatialUtils)

longitude <- seq(-120, -60, 5)
latitude <- seq(20, 80, 5)

getTimezone(longitude, latitude)


MazamaScience/MazamaSpatialUtils documentation built on Sept. 14, 2023, 6 p.m.