Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get the timezone of a picture from iOS camera roll

I'm trying to determine the timezone of a picture (to transform the date when it was taken in UTC format) reading from its EXIF data. I tried to take a picture and then to examine its metadata:

{
    ColorModel = RGB;
    DPIHeight = 72;
    DPIWidth = 72;
    Depth = 8;
    Orientation = 6;
    PixelHeight = 1936;
    PixelWidth = 2592;
    "{Exif}" =     {
        ApertureValue = "2.970854";
        BrightnessValue = "-2.571174";
        ColorSpace = 1;
        ComponentsConfiguration =         (
            1,
            2,
            3,
            0
        );
        DateTimeDigitized = "2012:12:13 01:21:55";
        DateTimeOriginal = "2012:12:13 01:21:55";
        ExifVersion =         (
            2,
            2,
            1
        );
        ExposureMode = 0;
        ExposureProgram = 2;
        ExposureTime = "0.06666667";
        FNumber = "2.8";
        Flash = 16;
        FlashPixVersion =         (
            1,
            0
        );
        FocalLenIn35mmFilm = 35;
        FocalLength = "3.85";
        ISOSpeedRatings =         (
            1000
        );
        MeteringMode = 5;
        PixelXDimension = 2592;
        PixelYDimension = 1936;
        SceneCaptureType = 0;
        SensingMethod = 2;
        ShutterSpeedValue = "3.9112";
        SubjectArea =         (
            1295,
            967,
            699,
            696
        );
        WhiteBalance = 0;
    };
    "{GPS}" =     {
        Altitude = "258.794";
        AltitudeRef = 0;
        ImgDirection = "24.38477";
        ImgDirectionRef = T;
        Latitude = "45.02183333333333";
        LatitudeRef = N;
        Longitude = "7.610833333333334";
        LongitudeRef = E;
        TimeStamp = "00:21:53.87";
    };
    "{TIFF}" =     {
        DateTime = "2012:12:13 01:21:55";
        Make = Apple;
        Model = "iPhone 4";
        Orientation = 6;
        ResolutionUnit = 2;
        Software = "6.0.1";
        XResolution = 72;
        YResolution = 72;
        "_YCbCrPositioning" = 1;
    };
}

It seems that it has the local time (DateTimeOriginal) and the UTC time ({GPS}->TimeStamp), but there is no indication about the offset between this twos. I could do something to determine the difference between DateTimeOriginal and TimeStamp, but the 2nd one doesn't have the date, so it seems to be tricky in the case they cross two different days.

Is there a way to get a full UTC date, or the local time WITH the timezone?

I was also thinking to determine the timezone from the lat/lon data, but this also seems to be complicated because it involves the use of external services to get the country from the coordinates.

like image 515
flip79 Avatar asked Nov 03 '22 08:11

flip79


1 Answers

I think your best shot is to use a web service.. I don't think you can get anything from this.

If you choose this option, have a look at earthtools. I heard it may be suffer a time offset (I did not see it though), but you won't care as all you want is the time zone.

It's really easy to use, for example, if you want the timezone in Paris, France (coordinates 48°51'44'N 2°21'03E), you call this page : http://www.earthtools.org/timezone-1.1/40.71417/2.2103, and you get this xml file :

<timezone xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://www.earthtools.org/timezone.xsd">
    <version>1.0</version>
    <location>
        <latitude>40.71417</latitude>
        <longitude>2.2103</longitude>
    </location>
    <offset>1</offset>
    <suffix>A</suffix>
    <localtime>13 Dec 2012 09:57:58</localtime>
    <isotime>2012-12-13 09:57:58 +0100</isotime>
    <utctime>2012-12-13 08:57:58</utctime>
    <dst>False</dst>
</timezone>
like image 111
rdurand Avatar answered Nov 08 '22 04:11

rdurand