# NAME

Geo::Hex1 - Convert between latitude/longitude and GeoHex code version 1

# SYNOPSIS

``````    use Geo::Hex1;

# From latitude/longitude to hex code

my \$code = latlng2geohex( \$lat, \$lng, \$level );

# From hex code to center latitude/longitude

my ( \$center_lat, \$center_lng, \$level ) = geohex2latlng( \$code );

# From hex code to hex polygon

my \$poly = geohex2polygon( \$code );

my ( \$wlat,  \$wlng  ) = @{\$poly->}; # West point
my ( \$nwlat, \$nwlng ) = @{\$poly->}; # North west point
my ( \$nelat, \$nelng ) = @{\$poly->}; # North east point
my ( \$elat,  \$elng  ) = @{\$poly->}; # East point
my ( \$selat, \$selng ) = @{\$poly->}; # South east point
my ( \$swlat, \$swlng ) = @{\$poly->}; # South west point
my ( \$wlat,  \$wlng  ) = @{\$poly->}; # West point again ( Same with 0 )

# Get hex distance between two hex codes

my \$dist = geohex2distance('wknR','wkmO'); # 3

# Get all hex codes list include in given hex distance

my \$list = distance2geohexes('8sijg',2);
foreach my \$code (@{\$list}) { print \$code . "\n" }
# 8sijh
# 8siig
# 8siif
# 8sijf
# 8sikg
# 8sikh
# 8sili
# 8siki
# 8siji
# 8siih
# 8sihg
# 8sihf
# 8sihe
# 8siie
# 8sije
# 8sikf
# 8silg
# 8silh``````

# EXPORT

`latlng2geohex( \$lat, \$lng )`

Convert latitude/longitude to GeoHex version 1 code.

`geohex2latlng( \$hex )`

Convert GeoHex version 1 code to center latitude/longitude, and level value.

`geohex2polygon( \$hex )`

Convert GeoHex version 1 code to polygon points.

`geohex2distance( \$hex1, \$hex2 )`

Get hex distance between two GeoHex version 1 codes.

`distance2geohexes( \$hex, \$distance )`

Get GeoHex version 1 codes list within given hex distance.

# DEPENDENCIES

Exporter POSIX Math::Round Math::Trig

# AUTHOR

OHTSUKA Ko-hei `<nene@kokogiko.net>`

Copyright (c) 2009-2010, OHTSUKA Ko-hei `<nene@kokogiko.net>`. All rights reserved.