ms2tiles -- TMS/Google tile calculations


ms2tiles <options>


-z, --zindex <arg>

Set tile z-index.

-r, --range <arg>

Show tile range which covers a given figure. Figure is a point ([lon,lat]), rectangle ([<lon>,<lat>,<width>,<height>]) line ([[lon1,lat1],[lon1,lat1],...]), multi-segment line in WGS84 coordinates, or a geodata file with tracks/waypoints.

--cover <arg>

Show all tiles which cover a given figure. Figure is set in the same way as in the --range option.

-t, --tiles <arg>

Show coordinate range for a given tile "[x,y]" or a tile range "[x,y,w,h]". If --tiles option is combined with --cover or --range, program returns with exit code 0 or 1 depending on whether the figure or its bounding is covered with the tile or the tile range.

-G, --google

By default the program works with TMS tiles. Use --google option to work with Google tiles instead.

-c, --center

Instead of printing a coordinate range print its central point.

-h, --help

Show help message.


Show help message as POD template.


A point with coordinates lon=69.1, lat=36.1 is located on the TMS tile with z=13, x=5668, y=4977:

$ ms2tiles -z 13 -r "[69.1,36.1]"

A coordinate range 1x1 degree starting at lon=69, lat=36 is covered by 23x29 Google tiles with z=13, starting with tile x=5666, y=3188:

$ ms2tiles -G -z 13 -r "[69,36,1,1]"

Finding a coordinate range for a TMS tile x=5666, y=4975, z=13

$ ms2tiles -z 13 -t "[5666,4975]"

Finding center of a tile:

$ ms2tiles -z 13 -c -t "[5666,4975]"

Checking if a tile touches a coordinate range:

$ ms2tiles -z 13 -t "[5666,4975]" -r "[69,36,1,1]"; echo $?
$ ms2tiles -z 13 -t "[5666,4975]" -r "[59,36,1,1]"; echo $?


Vladislav Zavjalov <>