This script allows to create a user-specified tiles that covers the polygons specified through a shapefile.
The script is used based on a shapefile containing one or more polygons :
$ python3 tile-generator.py --labels [polygon_shapefile]
--size [tile_size]
--output [output_directory]
[--x-shift/--y-shift [grid origin shift]]
The size allows to specify the width (and height) of the tile to produce. This value is interpreted into perspective of the geographical coordinates of the labels shapefile.
The output directory is used to dump the shapefile containing the computed tiles. The name of each file is generated according to the provided parameters.
The shift value allows to translate the origin of the grid on which tiles are attached. The default value is zero. The shifts are specified in proportion of the specified tile size.
The following illustrations give examples of computed tiles of 50m size with two value of shifts using buildings as labels :
Obtained tiles of 50m using building as labels
This script can also be considered of low amount of large scale labels to obtain covering tiles as shown on the following examples :
Tiled cover of a large area with 5000m and 2500m tiles
The script also ensures that no duplicated tiles are exported in the output shapefile.