Browse Source

fix: API cartes statiques

éviter de générer du vide quand certaines tuiles de la carte passent la date crossing line

inspiré de e5a3aee344 & 4ae1ebd7e9/mapbox.js (L27)
pull/46/head
b_b 3 months ago
parent
commit
233a7a0f8e
  1. 7
      inc/staticmap.php

7
inc/staticmap.php

@ -241,8 +241,13 @@ class staticMapGis
$this->offsetY += floor($startY - floor($this->centerY)) * $this->tileSize;
for ($x = $startX; $x <= $endX; $x++) {
// normalise x index for tile stitching at date crossing line
$xNorm = $x % (2 ** $this->zoom);
if ($xNorm < 0) {
$xNorm = $xNorm + (2 ** $this->zoom);
}
for ($y = $startY; $y <= $endY; $y++) {
$url = str_replace(['{Z}', '{X}', '{Y}'], [$this->zoom, $x, $y], $this->tileSrcUrl[$this->maptype]['url']);
$url = str_replace(['{Z}', '{X}', '{Y}'], [$this->zoom, $xNorm, $y], $this->tileSrcUrl[$this->maptype]['url']);
$tileData = $this->fetchTile($url);
if ($tileData) {
$tileImage = @imagecreatefromstring($tileData);

Loading…
Cancel
Save