<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">[![Build Status](https://travis-ci.org/karupanerura/Geo-Hex-V3-XS.svg?branch=master)](https://travis-ci.org/karupanerura/Geo-Hex-V3-XS)
# NAME

Geo::Hex::V3::XS - GeoHex implementation with XS. (c-geohex3 Perl5 binding.)

# SYNOPSIS

    use Geo::Hex::V3::XS;

    my $zone = Geo::Hex::V3::XS-&gt;new(code =&gt; 'XM488276746');

    # or

    my $zone = Geo::Hex::V3::XS-&gt;new(lat =&gt; 35.579826, lng =&gt; 139.654524, level =&gt; 9);

    say 'geohex.code:  ', $zone-&gt;code;
    say 'geohex.lat:   ', $zone-&gt;lat;
    say 'geohex.lng:   ', $zone-&gt;lng;
    say 'geohex.level: ', $zone-&gt;level;

# DESCRIPTION

Geo::Hex::V3::XS is [GeoHex](http://geohex.net/) implementation.

# FUNCTIONS

- `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.

# METHODS

- `my $zone = Geo::Hex::V3::XS-&gt;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-&gt;new(code =&gt; 'XM488548');

    - `lat/lng/level`

        Create geohex zone object from location with level.

            use Geo::Hex::V3::XS;

            my $zone = Geo::Hex::V3::XS-&gt;new(
                lat   =&gt; 40.5814792855475,
                lng   =&gt; 134.296601127877,
                level =&gt; 7,
            );

- `$zone-&gt;lat`

    Get geohex center location latitude.

- `$zone-&gt;lng`

    Get geohex center location longitude.

- `$zone-&gt;code`

    Get geohex code.

- `$zone-&gt;level`

    Get geohex level. (0-15)

- `$zone-&gt;size`

    Get geohex size.

- `my @locations = $zone-&gt;polygon()`

    Get vertex locations of a geohex polygon.

# LICENSE

Copyright (C) 2015 karupanerura &lt;karupa@cpan.org&gt;

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.

# AUTHOR

karupanerura &lt;karupa@cpan.org&gt;
</pre></body></html>