Tirex::Metatile(3pm)

NAME
Tirex::Metatile - A Metatile

SYNOPSIS
my $mt = Tirex::Metatile->new( map => 'osm', x => 16, y => 12, z=> 12 );

DESCRIPTION
A metatile.

METHODS

  Tirex::Metatile->new( ... )
Create new metatile object.

A metatile always needs the following parameters:

 map  the map config to use for rendering
 x    metatile x coordinate
 y    metatile y coordinate
 z    zoom level

You can give any x and y coordinate in the range 0 .. 2^z-1. It will be rounded down to the next tile coordinate.

Croaks if there is a problem with the parameters.

  Tirex::Metatile->new_from_filename_and_map($filename, $map)
Create metatile from filename. The first directory element must be the zoom level.

Optionally, the filename can start with '/' or './'.

  Tirex::Metatile->new_from_lon_lat(map => $map, lon => $lon, lat => $lat, z => $z)
Create metatile from zoom, longitude, and latitude.

  $mt->get_x()
Get x coordinate.

  $mt->get_y()
Get y coordinate.

  $mt->get_x()
Get zoom.

  $mt->get_map()
Get map.

  $mt->to_s()
Return string describing this metatile in the format 'map=MAP z=Z x=X y=Y'

  $mt->equals($other_metatile)
Returns true if both metatiles are the same, false otherwise.

The same tile means: same map, same x and y coordinates and same zoom level.

  $mt->up()
Return the metatile one zoom level above this metatile that contains this metatile.

  $mt->get_filename()
Return filename for this metatile.

Format is something like:
  [zoom]/[path].meta

  zoom          zoom level
  path          path with 4 directory elements and a filename
                based on x and y coordinates

  $mt->exists()
Does the metatile file for this metatile exist?

  $mt->older($time)
Is the metatile file older than the given time?

Returns 2 if the file doesn't exist.

  $mt->newer($time)
Is the metatile file newer than the given time?

Returns 2 if the file doesn't exist.

  $mt->size()
Return size of the metatile file.