Imager::Bing::MapLayer::Level - zoom levels for Bing Maps
my $level = Imager::Bing::MapLayer::Level->new( level => $level, # zoom level base_dir => $dir, # base directory (default '.') overwrite => 1, # overwrite existing (default) autosave => 1, # save on exit (default) in_memory => 0, # keep tiles in memory (default false) combine => 'darken', # tile combination method (default) ); $level->polygon( points => $points, # listref to [ lat, lon ] points fill => Imager::Fill->new( ... ), # );
level
The zoom level.
base_dir
The base directory to save tile files in.
centroid_latitude
This is the default latitude for translating points to pixels. Generally you don't need to worry about this.
centroid_longitude
This is the default longitude for translating points to pixels. Generally you don't need to worry about this.
tiles
A hash reference of Imager::Bing::MapLayer::Tile objects.
Imager::Bing::MapLayer::Tile
The keys are tile coordinates of the form $tile_x . $; . $tile_y.
$tile_x . $; . $tile_y
timeouts
last_cleanup_time
overwrite
When true (default), existing tiles will be overwritten rather than edited.
Be wary of editing existing tiles, since antialiased lines and opaque fills will darken existing points rather than drawing over them.
in_memory
The timeout for how many seconds a tile is kept in memory.
When a tile is timed out, it is saved to disk after each Imager drawing operation, and reloaded if it is later needed.
autosave
When true (default), tiles will be automatically saved.
Alternatively, you can use the "save" method.
combine
The tile combination method. It defaults to darken.
darken
tile_class
The base class used for tiles.
width
The width of the layer.
height
The height of the layer.
latlon_to_pixel
my ($x, $y) = $level->latlon_to_pixel($latitude, $longitude);
Translates a latitude and longitude coordinate into a pixel on the zoom level.
_translate_points
This is a utility method for translating points parameters from Imager methods.
points
At lower zoom levels, these are "optimized" by removing duplicate adjacent points.
_translate_coords
This is a utility method for translating box parameters from Imager methods.
box
_translate_radius
my $pixels = $level->_translate_radius( $meters, $min_pixels);
This method translates the r parameter for cirlces and arcs from meters into pixels.
r
If the $min_pixels parameter is given, then the radius will be no smaller than the given number of pixels. (This is useful to ensure that small circles show up on lower zoom levels.)
$min_pixels
_translate_point_arguments
This is an internal utility method for translating coordinate parameters from Imager methods.
_tile_coords_to_internal_key
my $key = $level->_tile_coords_to_internal_key($tile_x, $tile_y);
This is an internal method for generating a key for the "tiles" and "timeouts".
We join the tile coordinates into a small key to use for this, instead of generating a quad key (which requires more work, and is only needed for creating a new tile).
_internal_key_to_tile_coords
my ($tile_x, $tile_y) = $level->_internal_key_to_tile_coords($key);
This is an internal method for determining tile coordinates from a key. It is the inverse of "_tile_coords_to_internal_key".
_load_tile
my $tile = $level->_load_tile($tile_x, $tile_y, $overwrite);
This is an internal method that loads a tile for this level, if it exists. Otherwise it creates a new tile.
_cleanup_tiles
$level->_cleanup_tiles();
This is an internal method that removes tiles from memory that have not been drawn to within the "in_memory" timeout.
_make_imager_wrapper_method
This is an internal function generates wrapper methods for a tile's Imager::Draw methods.
Basically, it calculates the bounding box for whatever is to be drawn, and creates a Imager::Bing::MapLayer::Image "pseudo-tile" to draw on.
It then composes pieces from the pseudo tile onto the actual tile (using the "combine" method>).
filter
Apply a Imager::Filter to every tile in the level.
Only tiles that have been drawn to will have filters applied to them.
colourise
$level->colourise();
Runs the colourise method on tiles.
This method is intended to be run for after rendering on the level is completed, i.e. for post-processing of heatmap tiles.
save
$level->save();
Saves the titles.
If in_memory is non-zero, tiles that have timed out are removed from memory.
To install Imager::Bing::MapLayer, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Imager::Bing::MapLayer
CPAN shell
perl -MCPAN -e shell install Imager::Bing::MapLayer
For more information on module installation, please visit the detailed CPAN module installation guide.