~berthold-daum/zora/trunk

« back to all changes in this revision

Viewing changes to com.bdaum.zoom.batch.unix/exiftool/lib/Image/ExifTool/Geotag.pm

  • Committer: bdaum
  • Date: 2015-12-26 10:21:51 UTC
  • Revision ID: berthold.daum@bdaum.de-20151226102151-44f1j5113167thb9
VersionĀ 2.4.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
use vars qw($VERSION);
24
24
use Image::ExifTool qw(:Public);
25
25
 
26
 
$VERSION = '1.46';
 
26
$VERSION = '1.48';
27
27
 
28
28
sub JITTER() { return 2 }       # maximum time jitter
29
29
 
114
114
    my ($et, $val) = @_;
115
115
    my ($raf, $from, $time, $isDate, $noDate, $noDateChanged, $lastDate, $dateFlarm);
116
116
    my ($nmeaStart, $fixSecs, @fixTimes, $lastFix, %nmea);
117
 
    my ($canCut, $cutPDOP, $cutHDOP, $cutSats, $e0, $e1);
 
117
    my ($canCut, $cutPDOP, $cutHDOP, $cutSats, $e0, $e1, @tmp);
118
118
 
119
119
    unless (eval { require Time::Local }) {
120
120
        return 'Geotag feature requires Time::Local installed';
121
121
    }
122
122
    # add data to existing track
123
 
    my $geotag = $et->GetNewValues('Geotag') || { };
 
123
    my $geotag = $et->GetNewValue('Geotag') || { };
124
124
    # get lookup for available information types
125
125
    my $has = $$geotag{Has};
126
126
    $has or $has = $$geotag{Has} = { 'pos' => 1 };
197
197
                $format = 'IGC';
198
198
            } elsif (/^TP,D,/) {
199
199
                $format = 'Winplus';
200
 
            } elsif (/^\s*\d+\s+.*\sypr\s*$/ and split == 12) {
 
200
            } elsif (/^\s*\d+\s+.*\sypr\s*$/ and (@tmp=split) == 12) {
201
201
                $format = 'Bramor';
202
202
            } else {
203
203
                # search only first 50 lines of file for a valid fix
296
296
# Winplus Beacon text file
297
297
#
298
298
        } elsif ($format eq 'Winplus') {
 
299
            # TP,D, 44.933666667, -93.186555556, 10/26/2011, 19:07:28, 0
 
300
            #       latitude      longitude      date        time
299
301
            /^TP,D,\s*([-+]?\d+\.\d*),\s*([-+]?\d+\.\d*),\s*(\d+)\/(\d+)\/(\d{4}),\s*(\d+):(\d+):(\d+)/ or next;
300
302
            $$fix{lat} = $1;
301
303
            $$fix{lon} = $2;
310
312
# Bramor gEO log file
311
313
#
312
314
        } elsif ($format eq 'Bramor') {
 
315
            #   1 0015   18.723675   50.672752  149 169.31 22/04/2015 07:06:55 169.31    8.88   28.07 ypr
 
316
            #   ? index  latitude    longitude  alt track  date       time     dir       pitch  roll
313
317
            my @parts = split ' ', $_;
314
318
            next unless @parts == 12 and $parts[11] eq 'ypr';
315
319
            my @d = split m{/}, $parts[6];  # date (dd/mm/YYYY)
373
377
            /^\$GPGGA,(\d{2})(\d{2})(\d+(\.\d*)?),(\d*?)(\d{1,2}\.\d+),([NS]),(\d*?)(\d{1,2}\.\d+),([EW]),[1-6]?,(\d+)?,(\.\d+|\d+\.?\d*)?,(-?\d+\.?\d*)?,M?,/ or next;
374
378
            $fix{lat} = (($5 || 0) + $6/60) * ($7 eq 'N' ? 1 : -1);
375
379
            $fix{lon} = (($8 || 0) + $9/60) * ($10 eq 'E' ? 1 : -1);
376
 
            $fix{nsats} = $11;
377
 
            $fix{hdop} = $12;
378
 
            $fix{alt} = $13;
 
380
            @fix{qw(nsats hdop alt)} = ($11,$12,$13);
379
381
            $secs = (($1 * 60) + $2) * 60 + $3;
380
382
            $canCut = 1;
381
383
#
610
612
sub ApplySyncCorr($$)
611
613
{
612
614
    my ($et, $time) = @_;
613
 
    my $sync = $et->GetNewValues('Geosync');
 
615
    my $sync = $et->GetNewValue('Geosync');
614
616
    if (ref $sync eq 'HASH') {
615
617
        my $syncTimes = $$sync{Times};
616
618
        if ($syncTimes) {
704
706
{
705
707
    local $_;
706
708
    my ($et, $val, $writeGroup) = @_;
707
 
    my $geotag = $et->GetNewValues('Geotag');
 
709
    my $geotag = $et->GetNewValue('Geotag');
708
710
    my $verbose = $et->Options('Verbose');
709
711
    my ($fix, $time, $fsec, $noDate, $secondTry, $iExt, $iDir);
710
712
 
1011
1013
sub ConvertGeosync($$)
1012
1014
{
1013
1015
    my ($et, $val) = @_;
1014
 
    my $sync = $et->GetNewValues('Geosync') || { };
 
1016
    my $sync = $et->GetNewValue('Geosync') || { };
1015
1017
    my ($syncFile, $gpsTime, $imgTime);
1016
1018
 
1017
1019
    if ($val =~ /(.*?)\@(.*)/) {