A perimeter is defined by adding a perimeter threshold (p) to a decimal tile vector or number which represents p adjacent tiles to each direction. This means that the perimeter contains a central tile which is part of a matrix that has (p x 2) + 1 columns and rows. A perimeter is denoted by concatenating a dot and the perimeter threshold to the central tile. The API converts tiles or perimeters to coordinates which can be suppoerimposed on mapping systems or naviagation applications as grids or interactive areas. The API enables generation of geoJSON objects that contain tile coordinates and metadata of the perimeters and the tiles within.
<script src="https://cdn.jsdelivr.net/gh/dTile/DT/dist/dtile.js"></script>// vanilla JS
//
var geoJSON = DT.perimJSON(25050,3);
//get a perimeter of threshold 3 around "Null Island" in zoom level 2;
//
var tile = DT.dtXYZ(51,51,2)
console.log(tile.coords);
//Get the tile located 51 tiles south of the north pole and one tile east to the meridian at zoom level 2
//In zoom level 2 the map is split to 100x100 tiles;
Note
Tiles visually seem to form perfect adjacent squares or a grid. The tiles are actually trapezoids that look like squares due to earth curvature under the Mercator projection model.
DT is released under the MIT license
