1. Go to this page and download the library: Download kayw-geek/map-tiles library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
kayw-geek / map-tiles example snippets
use KaywGeek\Map;
class Map
{
use MapTraits;
<...>
}
//Returns 2 pairs of latitude and longitude from a given latitude and longitude calculation range
$m = new Map();
$m->rangeValue = 0.5;
$range = $m->computeRangeByLonLat(116.4074,39.9042);
//Longitude and latitude are converted to tile coordinates
$m->lonLat2Tile(116.4074,39.9042,11);
//Get the path of the Open Strrt Map tile resource image by tile coordinates and zoom
$m->getTileImgPath([1686,776],11);
//Get image name by tile coordinates and zoom
$m->getImgName([1686,776],11);
//Download file to local
$m->download('https://tile.openstreetmap.org/11/1686/776.png','./data/11_1686_776.png');
//Get the full tile image path of OpenStreetMap with the latitude and longitude range value zoom level
$m->getAllImgPath(['116.20740','39.70420','116.60740','40.10420'],10);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.