NAME
Geo::Coordinates::GMap - Routines for converting decimal lat/lon to Google Map tiles, and back again.
SYNOPSIS
use Geo::Coordinates::GMap;
my ($tile_x, $tile_y, $x, $y) = coord_to_tile( $lat, $lon, $zoom );
DESCRIPTION
While working on the mapping tools on toxicrisk.com I came to the conclusion that we were dealing with too much data to make everything a GMarker, even when using the marker manager.
So, I needed to generate static map tile images. But, to do this, I needed a way to convert my decimal lat/lon points in to tile numbers, and the pixel values on those tiles.
This module makes this proces simple and accurate.
FUNCTIONS
coord_to_tile
my ($tile_x, $tile_y, $x, $y) = coord_to_tile( $lat, $lon, $zoom );
Given a decimal latitude and longitude, and a google maps zoom level (0 being farthest away and 19 being the closest that I'm aware of that you can get), this function will return the following list of values:
- tile_x: The tiles x-coordinate.
- tile_y: The tiles y-coordinate.
- x: The x position of the pixel within the tile.
- y: The y position of hte pixel within the tile.
TODO
AUTHOR
Aran Clary Deltac <bluefeet@cpan.org>
LICENSE
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.