Skip to content

Instantly share code, notes, and snippets.

@shoorick shoorick/gpsout.pl
Created May 11, 2010

Embed
What would you like to do?
Print out GPS coordinates from images
#!/usr/bin/perl -wl
use strict;
=head1 DESCRIPTION
Print out GPS coordinates from images
=head1 AUTHOR
Alexander Sapozhnikov
L<http://shoorick.ru/>
L<< E<lt> shoorick at cpan.org E<gt> >>
=cut
use Image::ExifTool qw(:Public);
foreach my $file ( @ARGV ) {
my $info = ImageInfo($file);
my @gps = ( $$info{'GPSLatitude'}, $$info{'GPSLongitude'} );
print $file, ' - ', join( q{,}, map { &convert } @gps ), ' < ', join( q{,}, @gps );
} # foreach
sub convert {
return '?'
unless /(\d+) deg (\d+)' ([\d\.]+)"/;
my $coord = $1 + $2/60 + $3/3600;
$coord = -$coord
if /[WS]$/;
return $coord;
} # sub convert
@shoorick

This comment has been minimized.

Copy link
Owner Author

commented May 11, 2010

Выводит сохранённые в EXIF географические координаты у изображений, переданных в качестве аргументов.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.