/**
  * @param float $longitude
  * @param float $latitude
  * @param int $zoom
  * @return Tile
  */
 protected function coordinatesToTile($longitude, $latitude, $zoom)
 {
     $tile = new Tile();
     $tile->z = $zoom;
     $tile->x = Calculator::longitudeToX($longitude, $zoom);
     $tile->y = Calculator::latitudeToY($latitude, $zoom);
     return $tile;
 }
 /**
  * @param Tile $tile
  * @return string
  */
 protected function tileUrl(Tile $tile)
 {
     $url = $this->domains[array_rand($this->domains)];
     $url = str_replace('{z}', $tile->z, $url);
     $url = str_replace('{x}', $tile->x, $url);
     $url = str_replace('{y}', Calculator::flipYTmsToOsm($tile->y, $tile->z), $url);
     return $url;
 }