Geo::Location::Point - Location information
Version 0.11
Geo::Location::Point stores a place.
use Geo::Location::Point; my $location = Geo::Location::Point->new(latitude => 0.01, longitude => -71);
$location = Geo::Location::Point->new({ latitude => 0.01, longitude => -71 });
Takes one optional argument 'key' which is an API key for https://timezonedb.com for looking up timezone data.
print 'Latitude: ', $location->lat(), "\n"; print 'Longitude: ', $location->long(), "\n";
Synonym for lat().
Synonym for long().
Determine the distance between two locations, returns a Class::Measure::Length object.
Are two points the same?
my $loc1 = Geo::Location::Point->new(lat => 2, long => 2); my $loc2 = Geo::Location::Point->new(lat => 2, long => 2); print ($loc1 == $loc2), "\n"; # Prints 1
Are two points different?
my $loc1 = Geo::Location::Point->new(lat => 2, long => 2); my $loc2 = Geo::Location::Point->new(lat => 2, long => 2); print ($loc1 != $loc2), "\n"; # Prints 0
Returns the timezone of the location. Needs TimeZone::TimeZoneDB.
Synonym for tz().
Prints the object in human-readable format.
Get/set location attributes, e.g. city
$location->city('London'); $location->country('UK'); print $location->as_string(), "\n"; print "$location\n"; # Calls as_string
Because of the way that the cache works, the location() value is cleared by this, so you may wish to manually all location() afterwards to set the value.
Nigel Horne <njh@bandsman.co.uk>
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
GIS::Distance, Geo::Point, TimeZone::TimeZoneDB.
Copyright 2019-2023 Nigel Horne.
The program code is released under the following licence: GPL2 for personal use on a single computer. All other users (including Commercial, Charity, Educational, Government) must apply in writing for a licence for use from Nigel Horne at `<njh at nigelhorne.com>`.
To install Geo::Location::Point, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Geo::Location::Point
CPAN shell
perl -MCPAN -e shell install Geo::Location::Point
For more information on module installation, please visit the detailed CPAN module installation guide.