Image::ExifTool::Location - Easy setting, getting of an image's location information
This document describes Image::ExifTool::Location version 0.0.4
use Image::ExifTool; use Image::ExifTool::Location; my $exif = Image::ExifTool->new(); # Extract info from existing image $exif->ExtractInfo($src); # Set location $exif->SetLocation(54.787515, -2.341355); # Set elevation $exif->SetElevation(515); # Write new image $exif->WriteInfo($src, $dst);
Image::ExifTool is a versatile module for reading and writing EXIF data in a number of image formats. This module extends its interface adding methods that simplify the reading and writing of GPS location information.
Image::ExifTool
Without this module the interface for working with GPS location information is cryptic. To store latitude and longitude a total of four EXIF values are used - two to store the latitude and longitude in degrees, minutes and seconds format and two to store the hemisphere (north / south, east / west).
This module replaces that cryptic interface with simple calls (GetLocation and SetLocation) that take care of encoding and decoding the latitude and longitude values correctly.
GetLocation
SetLocation
The methods this module provides are added directly to Image::ExifTool's interface. To use them do something like this:
use Image::ExifTool; use Image::ExifTool::Location; my $exif = Image::ExifTool->new(); $exif->ExtractInfo($src); $exif->SetLocation(54.787515, -2.341355); $exif->WriteInfo($src, $dst);
All of the methods described below are implemented in terms of Image::ExifTool's GetValue and SetNewValue methods. Read the documentation for Image::ExifTool for more information.
GetValue
SetNewValue
HasLocation()
Returns true if the image contains all of these EXIF tags:
GPSLatitude GPSLatitudeRef GPSLongitude GPSLongitudeRef
HasElevation()
Returns true if the image contains both of these EXIF tags:
GPSAltitude GPSAltitudeRef
SetLocation( $lat, $lon )
Set the image's GPS location to the specified latitude and longitude.
SetElevation( $ele )
Set the image's GPS elevation to the specified height in metres. Use negative values for locations below sea level.
GetLocation()
Return the image's GPS location as a two element list:
my ($lat, $lon) = $exif->GetLocation();
GetElevation()
Return the image's GPS elevation:
my $ele = $exif->GetElevation();
Call Image::ExifTool->new() instead of Image::ExifTool::Location->new()
This module adds methods directly to Image::ExifTool. After
use Image::ExifTool::Location;
create a new Image::ExifTool object as normal.
SetLocation must be called with the latitude and longitude
SetLocation requires latitude and longitude values in decimal degrees.
SetElevation must be called with the elevation in metres
SetElevation requires the elavation in metres as a signed number.
SetElevation
GetLocation must be called in a list context
GetLocation returns latitude and longitude as a two element list.
Image::ExifTool Geo::Coordinates::DecimalDegrees
Image::ExifTool::Location requires no configuration files or environment variables.
None reported.
No bugs have been reported.
Please report any bugs or feature requests to bug-image-exiftool-location@rt.cpan.org, or through the web interface at http://rt.cpan.org.
bug-image-exiftool-location@rt.cpan.org
Andy Armstrong <andy@hexten.net>
<andy@hexten.net>
Copyright (c) 2006, Andy Armstrong <andy@hexten.net>. All rights reserved.
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic.
BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR, OR CORRECTION.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENCE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
To install Image::ExifTool::Location, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Image::ExifTool::Location
CPAN shell
perl -MCPAN -e shell install Image::ExifTool::Location
For more information on module installation, please visit the detailed CPAN module installation guide.