---
name: "Tirex::Metatile"
section: "3pm"
platform: "linux"
package: "tirex"
version: "0.7.1-3+b2"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/Tirex::Metatile"
---

# Tirex::Metatile(3pm)

A Metatile

## 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.
