Geo::Integer - Generates a single integer from Lat and Lon coordinates
use Geo::Integer; my $gi=Geo::Integer->new(); my $integer=$gint->integer($lat, $lon); my ($lat, $lon)=$gint->center($int);
This module generates a 32-bit integer which represents a two dimensional value. The defaults are latitude and longitude in degrees but there should be no limitation for using any Cartesian grid. The integer returned actually represents a rectangular area like the image below.
ul ---------------- ur |....................| |....................| |.......center.......| |....................| |....................| ll ---------------- lr
By definition the center and ll values are "in" the rectangle. ul, ur and lr are by definition "in" adjacent rectangles.
my $obj = Geo::Integer->new(); my $obj = Geo::Integer->new(latmin => -90, #defaults lonmin => -180, latrange => 180, lonrange => 360 );
Returns a 32-bit integer representing a rectangle that contains the given coordinates.
my $integer=$gint->integer($lat, $lon);
Returns the center of the rectangle given the integer.
my $center=$gint->center($integer);
Returns the lower left coordinate of the retangle given the integer.
my ($lat, $lon)=$gint->ll($int);
Returns the upper left coordinate of the retangle given the integer.
my ($lat, $lon)=$gint->ul($int);
Returns the upper right coordinate of the retangle given the integer.
my ($lat, $lon)=$gint->ur($int);
Returns the lower right coordinate of the retangle given the integer.
my ($lat, $lon)=$gint->lr($int);
Returns a single 32-bit integer from two 16-bit integers.
my $int32=$gint->interlace($int16l, $int16h);
Returns 16-bit integer from a latitude.
Returns 16-bit integer from a longitude.
Returns two 16-bit integers from a single 32-bit integer.
my ($int16l, $int16h)=gint->unlace($int32);
Returns latitude from a 16-bit integer.
Returns longitude from a 16-bit integer.
Try geo-perl email list
Michael R. Davis
CPAN ID: MRDVT
account=>perl,tld=>com,domain=>michaelrdavis
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
The full text of the license can be found in the LICENSE file included with this module.