Geo metadata - 位置に関するメタデータとその応用[百分率の小数点以下] = [分] / 60 + [秒] / 3600
コード
#!/usr/bin/perl -w
use Image::ExifTool 'ImageInfo';
my $file = shift or die "Please specify filename";
my $info = ImageInfo($file);
my $GPSPosition = $info->{GPSPosition};
if( defined $GPSPosition ){
#35 deg 40' 21.90" N, 139 deg 43' 27.37" E
$GPSPosition =~ s/^(\d*) deg (\d*)\' ([0-9\.]*)\" N, (\d*) deg (\d*)\' ([0-9\.]*)\" E$/$1 $2 $3 $4 $5 $6/;
my @val = split( / /, $GPSPosition );
my $lat = $val[0] + $val[1] / 60.0 + $val[2] / 3600.0;
my $long = $val[3] + $val[4] / 60.0 + $val[5] / 3600.0;
print "<a href=\"http://maps.google.co.jp/maps?q=", $lat, "," , $long, "&z=16\">Google Map</a>\n";
}
サンプル画像
実行結果
<a href="http://maps.google.co.jp/maps?q=35.67275,139.724269444444&z=16">Google Map</a>