Skip to content

Commit

Permalink
Add NA fallback back in
Browse files Browse the repository at this point in the history
There are some arctic/antarctic areas still without timezones. See evansiroky/timezone-boundary-builder#42
  • Loading branch information
ateucher committed Jun 24, 2018
1 parent 0486bb8 commit eaba9fc
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion R/tz_lookup.R
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,15 @@ tz_lookup_accurate <- function(x, crs = NULL) {
tz_lookup_accurate.sf <- function(x, crs = NULL) {
x <- fix_sf(x, crs)
x <- suppressMessages(sf::st_join(x, tz_sf))
x$tzid
ret <- x$tzid

# If any are NA, try to fill in with V8-based tzlookup
nas <- which(is.na(ret))
if (!length(nas)) {
return(ret)
}
ret[nas] <- tz_lookup_fast(x[nas, ], warn = FALSE)
ret
}

tz_lookup_accurate.sfc <- function(x, crs = NULL) {
Expand Down

0 comments on commit eaba9fc

Please sign in to comment.