define mapTypeAliases more explicitly

Define 'mapnik' and 'osmrender' explcitly as aliases of 'standard' rather than
just setting to the same tile URL. That approach would mean the aliases will
have their own cache directory (which is unnecessary). Now they will all use
the 'standard' cache directory.
This commit is contained in:
Harry Wood 2017-01-22 15:28:46 +00:00
parent 87c59e2dfd
commit 9530e62141
1 changed files with 9 additions and 3 deletions

View File

@ -37,11 +37,15 @@ Class staticMapLite
protected $tileSize = 256;
protected $tileSrcUrl = array(
'standard' => 'http://tile.openstreetmap.org/{Z}/{X}/{Y}.png',
'mapnik' => 'http://tile.openstreetmap.org/{Z}/{X}/{Y}.png', /* deprecated alias */
'osmarenderer' => 'http://tile.openstreetmap.org/{Z}/{X}/{Y}.png', /* mapped value from discontinued tile server */
'cycle' => 'http://a.tile.opencyclemap.org/cycle/{Z}/{X}/{Y}.png',
);
// Deprecated map_type values still supported as aliases
protected $mapTypeAliases = array(
'mapnik' => 'standard',
'osmarender' => 'standard'
);
protected $tileDefaultSrc = 'standard';
protected $markerBaseDir = 'images/markers';
protected $osmLogo = 'images/osm_logo.png';
@ -144,7 +148,9 @@ Class staticMapLite
}
if ($_GET['maptype']) {
if (array_key_exists($_GET['maptype'], $this->tileSrcUrl)) $this->maptype = $_GET['maptype'];
$mapTypeParam = $_GET['maptype'];
if (array_key_exists($mapTypeParam, $this->mapTypeAliases)) $mapTypeParam = $this->mapTypeAliases[$mapTypeParam];
if (array_key_exists($mapTypeParam, $this->tileSrcUrl)) $this->maptype = $mapTypeParam;
}
}