Aran Clary Deltac > Geo-Coordinates-GMap-0.05 > Geo::Coordinates::GMap

Download:
Geo-Coordinates-GMap-0.05.tar.gz

Dependencies

Annotate this POD

CPAN RT

Open  0
View/Report Bugs
Module Version: 0.05   Source   Latest Release: Geo-Coordinates-GMap-0.07

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) = coord_to_gmap_tile( $lat, $lon, $zoom );
    my ($new_tile_x, $new_tile_y) = zoom_gmap_tile( $tile_x, $tile_y, $old_zoom, $new_zoom );
    my ($x, $y) = gmap_tile_xy( $tile_x, $tile_y );

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 process simple and accurate.

FUNCTIONS ^

coord_to_gmap_tile

    my ($tile_x, $tile_y) = coord_to_gmap_tile( $lat, $lon, $zoom );

Given a decimal latitude and longitude, and a Google Maps zoom level (0 being farthest away and 20 being the closest that I'm aware of that you can get), this function will return the GMap tile location as a fractional x and y coordinate.

zoom_gmap_tile

    my ($new_tile_x, $new_tile_y) = zoom_gmap_tile( $tile_x, $tile_y, $old_zoom, $new_zoom );

Converts fractional tile coordinates, as created by coord_to_gmap_tile(), from one zoom level to another.

gmap_tile_xy

    my ($x, $y) = gmap_tile_xy( $tile_x, $tile_y );

Given a tile's x and y coordinate as provided by coord_to_gmap_tile(), this function will return the pixel location within the tile. This function will return a fractional number. In most cases you will want to remove the fractional portion.

TODO ^

Implement a routine to convert tile coordinates back in to lat/lon decimal coordinates.

AUTHOR ^

Aran Clary Deltac <bluefeet@gmail.com>

LICENSE ^

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.

syntax highlighting: