I'm looking for a way to use Perl to get the time zone corresponding to a given latitude and longitude. Any program that runs on Linux would be okay too.
I have pictures with time in UTC and GPS coordinates and I want to use them on a website with the local time and date.
I found the Geo::Location::TimeZone
module on CPAN which looks like it could do the job, but it doesn't work and I'm still trying to figure out why.
Depending on the amount of lookups you need to do and the terms of use, the Google Time Zone service looks trivial to use.
use strict;
use warnings;
use LWP::Simple;
use JSON::Any;
my ($lat, $long) = (39.6034810,-119.6822510);
my $apikey = 'whatever';
my $time = time();
my $location = JSON::Any->jsonToObj(get("https://maps.googleapis.com/maps/api/timezone/json?location=$lat,$long×tamp=$time&sensor=false&key=$apikey"));
say $location->{timeZoneId}; # America/Los_Angeles
say $location->{timeZoneName}; # Pacific Standard Time