Geo::Heatmap - generate a density map (aka heatmap) overlay layer for Google Maps
version 0.08
Moose Storable CHI Image::Magick
tile(); return the tile image in png format
debug cache logfile return_points zoom_scale palette
Create a Heatmap layer for GoogleMaps
my $ghm = Geo::Heatmap->new(); $ghm->palette('palette.store'); $ghm->zoom_scale( { 1 => 298983, 2 => 177127, 3 => 104949, 4 => 90185, 5 => 70338, 6 => 37742, 7 => 28157, 8 => 12541, 9 => 3662, 10 => 1275, 11 => 417, 12 => 130, 13 => 41, 14 => 18, 15 => 10, 16 => 6, 17 => 2, 18 => 0, } ); $ghm->cache($cache); $ghm->return_points( \&get_points ); my $image = $ghm->tile($tile);
You need a color palette (one is included) to encode values to colors, in Storable Format as an arrayref of arrayrefs eg
[50] = [34, 45, 56]
which means that a normalized value of 50 would lead to an RGB color of 34% red , 45% blue, 56% green.
The maximum number of points for a given google zoom scale. You would be able to extract to values from the denisity log or derive them from your data in some cunning way
You need some caching for the tiles otherwise the map would be quite slow. Use a CHI object with the cache you like
A function reference which expects a single hashref as a parameter which defines two LAT/LONG points to get all data points within this box:
$r->{LATN}, $r->{LNGW}), $r->{LATS}, $r->{LNGE}
The function has to return an arrayref of arrayrefs of the points within the box
Returns the rendered image
Mark Hofstetter <hofstettm@cpan.org>
Thanks to brian d foy Marcel Gruenauer
* change to GoogleMaps API v3 * put more magic in calculation of zoom scales * make more things configurable * add even more tests * Rewrite to use Imager http://search.cpan.org/~addi/Imager-0.43/Imager.pm * ...
This software is copyright (c) 2013 by Mark Hofstetter
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Geo::Heatmap, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Geo::Heatmap
CPAN shell
perl -MCPAN -e shell install Geo::Heatmap
For more information on module installation, please visit the detailed CPAN module installation guide.