timezone - Look up time zone from latitude and longitude using Perl -
i'm looking way use perl time zone corresponding given latitude , longitude. program runs on linux okay too.
i have pictures time in utc , gps coordinates , want use them on website local time , date.
i found geo::location::timezone
module on cpan looks job, doesn't work , i'm still trying figure out why.
depending on amount of lookups need , terms of use, google time zone service looks trivial use.
use strict; use warnings; use lwp::simple; use json::any; ($lat, $long) = (39.6034810,-119.6822510); $apikey = 'whatever'; $time = time(); $location = json::any->jsontoobj(get("https://maps.googleapis.com/maps/api/timezone/json?location=$lat,$long×tamp=$time&sensor=false&key=$apikey")); $location->{timezoneid}; # america/los_angeles $location->{timezonename}; # pacific standard time
Comments
Post a Comment