There are two methods - "fast", and "accurate". The "fast" version can look up many thousands of points very quickly, however when a point is near a time zone boundary and not near a populated centre, it may return the incorrect time zone. If accuracy is more important than speed, use method = "accurate".

tz_lookup_coords(lat, lon, method = "fast", warn = TRUE)

Arguments

lat

numeric vector of latitudes

lon

numeric vector of longitudes the same length as x

method

method by which to do the lookup. Either "fast" (default) or "accurate".

warn

By default, if method = "fast" a warning is issued about the potential for inaccurate results. Set warn to FALSE to turn this off.

Value

character vector the same length as x and y specifying the time zone of the points.

Examples

tz_lookup_coords(42, -123)
#> Warning: Using 'fast' method. This can cause inaccuracies in time zones #> near boundaries away from populated ares. Use the 'accurate' #> method if accuracy is more important than speed.
#> [1] "America/Los_Angeles"
tz_lookup_coords(lat = c(48.9, 38.5, 63.1, -25), lon = c(-123.5, -110.2, -95.0, 130))
#> Warning: Using 'fast' method. This can cause inaccuracies in time zones #> near boundaries away from populated ares. Use the 'accurate' #> method if accuracy is more important than speed.
#> [1] "America/Vancouver" "America/Denver" "America/Rankin_Inlet" #> [4] "Australia/Darwin"