Geo::Hex::V3::XS - GeoHex implementation with XS. (c-geohex3 Perl5 binding.)
use Geo::Hex::V3::XS; my $zone = Geo::Hex::V3::XS->new(code => 'XM488276746'); # or my $zone = Geo::Hex::V3::XS->new(lat => 35.579826, lng => 139.654524, level => 9); say 'geohex.code: ', $zone->code; say 'geohex.lat: ', $zone->lat; say 'geohex.lng: ', $zone->lng; say 'geohex.level: ', $zone->level;
Geo::Hex::V3::XS is GeoHex implementation.
my $geohex_code = encode_geohex($lat, $lng, $level)
Convert location,level to geohex's code.
my ($lat, $lng, $code) = decode_geohex($geohex_code)
Convert geohex's code to location,level. This location is center of geohex.
my $size = geohex_hexsize($level)
Calculate geohex hex size by level.
my $zone = Geo::Hex::V3::XS->new(...)
Create geohex zone object.
Arguments can be:
code
Create geohex zone object from geohex code.
use Geo::Hex::V3::XS; my $zone = Geo::Hex::V3::XS->new(code => 'XM488548');
lat/lng/level
Create geohex zone object from location with level.
use Geo::Hex::V3::XS; my $zone = Geo::Hex::V3::XS->new( lat => 40.5814792855475, lng => 134.296601127877, level => 7, );
$zone->lat
Get geohex center location latitude.
$zone->lng
Get geohex center location longitude.
$zone->code
Get geohex code.
$zone->level
Get geohex level. (0-15)
$zone->size
Get geohex size.
my @locations = $zone->polygon()
Get vertex locations of a geohex polygon.
Copyright (C) 2015 karupanerura <karupa@cpan.org>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Copyright (c) 2009 @sa2da (http://twitter.com/sa2da) http://www.geohex.org Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
karupanerura <karupa@cpan.org>
To install Geo::Hex::V3::XS, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Geo::Hex::V3::XS
CPAN shell
perl -MCPAN -e shell install Geo::Hex::V3::XS
For more information on module installation, please visit the detailed CPAN module installation guide.