[R] time zones from longitude, latitude, and date

Gabor Grothendieck ggrothendieck at gmail.com
Sun Sep 22 14:25:20 CEST 2013


On Sat, Sep 21, 2013 at 10:25 AM, David Winsemius
<dwinsemius at comcast.net> wrote:
>
> On Sep 21, 2013, at 3:13 AM, Prof Brian Ripley wrote:
>
>> On 21/09/2013 08:17, Gabor Grothendieck wrote:
>>>
>>> On Fri, Sep 20, 2013 at 4:31 PM, carlisle thacker
>>> <carlisle.thacker at gmail.com> wrote:
>>>>
>>>> I was looking for something like shown on the map:
>>>>
>>>> http://upload.wikimedia.org/wikipedia/commons/8/88/World_Time_Zones_Map.png
>>>>
>>>> Information about local daylight savings times would also help.
>>>>
>>>> The data are from ships, supposedly in local time, but no time-zone info
>>>> is
>>>> given.  A function that would return time zone and whether or not
>>>> daylight
>>>> savings time applies at given date would would help.  I'm trying to
>>>> track
>>>> down more information about the data and whether they can be referenced
>>>> to
>>>> UTC.
>>>
>>>
>>> The zone.tab file has this information.  See the Examples section at
>>> the end of ?Sys.timezone for info on its whereabouts.
>>
>>
>> On some OSes only.
>
>
> This is a couple of snippets of that file from a Mac:
> /usr/share/zoneinfo/zone.tab
> #-------------
> # This file contains a table with the following columns:
> # 1.  ISO 3166 2-character country code.  See the file `iso3166.tab'.
> # 2.  Latitude and longitude of the zone's principal location
> #     in ISO 6709 sign-degrees-minutes-seconds format,
> #     either +-DDMM+-DDDMM or +-DDMMSS+-DDDMMSS,
> #     first latitude (+ is north), then longitude (+ is east).
> # 3.  Zone name used in value of TZ environment variable.
> # 4.  Comments; present if and only if the country has multiple rows.
> #---------
>
> US      +340308-1181434 America/Los_Angeles     Pacific Time
> US      +611305-1495401 America/Anchorage       Alaska Time
> US      +581807-1342511 America/Juneau  Alaska Time - Alaska panhandle
> US      +593249-1394338 America/Yakutat Alaska Time - Alaska panhandle neck
> US      +643004-1652423 America/Nome    Alaska Time - west Alaska
> US      +515248-1763929 America/Adak    Aleutian Islands
> US      +211825-1575130 Pacific/Honolulu        Hawaii
> UY      -3453-05611     America/Montevideo
> UZ      +3940+06648     Asia/Samarkand  west Uzbekistan
> UZ      +4120+06918     Asia/Tashkent   east Uzbekistan
> VA      +415408+0122711 Europe/Vatican
>
>
> After looking at it I'm not sure it will be of much additional value for the
> purposes outlined. It does not provide boundaries of time zones.

The idea is to take the nearest lat/long found. If the input data is
lat/longs of major cities then it would likely work exactly.  If not
then it would only be an approximation but that might be sufficient
depending on one's purpose.  The nice thing is that the time zones you
get out is precisely the ones that R can use.

-- 
Statistics & Software Consulting
GKX Group, GKX Associates Inc.
tel: 1-877-GKX-GROUP
email: ggrothendieck at gmail.com



More information about the R-help mailing list