timezone: TZ timezone name query

Description Usage Arguments Details Value Author(s) Examples

Description

Returns TZ timezone names for each provided location.

Usage

1
find_tz(x, y, p4s = "", use_google = FALSE)

Arguments

x

the x coordinates of the locations. Alternatively, an n x 2 matrix or data frame of coordinates or an sp SpatialPoints object.

y

the y coordinates of the locations, optional if x is an appropriate structure.

p4s

the proj4 string for the coordinates if they are not currently in lat / long.

use_google

boolean argumenting indicating if the Google Maps API should be used.

Details

Given a set of coordinates this functions returns the timezone names for each using either Eric Muller's world timezone shapefile (http://efele.net/maps/tz/world/) or the Google Maps API.

For locations where an approapriate timezone name is not found NA will be returned.

Value

A vector of timezone names.

Author(s)

Colin Rundel

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
library(lubridate)

cities = data.frame(
            City = c("Tokyo", "Shanghai", "New Delhi", "Moscow", "Istanbul", "New York", "London"), 
            Lat  = c(35.685, 31.045, 28.6, 55.752, 41.018, 40.714, 51.514), 
            Long = c(139.751, 121.399, 77.2, 37.615, 28.964, -74.006, -0.093)
         )

(tzs = find_tz(cities$Long, cities$Lat)) 

lapply(tzs, now)

rundel/timezone documentation built on May 28, 2019, 10:41 a.m.