mirror of
https://github.com/klokantech/tileserver-php.git
synced 2025-08-04 13:47:49 +02:00
Custom profile testing implemetation
This commit is contained in:
@@ -718,7 +718,7 @@ class Wmts extends Server {
|
|||||||
$this->getCapabilities();
|
$this->getCapabilities();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default TileMetrixSet for Pseudo Mercator projection 3857
|
* Default TileMetrixSet for Pseudo Mercator projection 3857
|
||||||
* @return string TileMatrixSet xml
|
* @return string TileMatrixSet xml
|
||||||
@@ -728,14 +728,14 @@ class Wmts extends Server {
|
|||||||
$corner = array(-20037508.34278925, 20037508.34278925);
|
$corner = array(-20037508.34278925, 20037508.34278925);
|
||||||
$scalesBase = 559082264.0287178;
|
$scalesBase = 559082264.0287178;
|
||||||
$scales = array();
|
$scales = array();
|
||||||
|
|
||||||
for($i = 0; $i <= 18; $i++){
|
for($i = 0; $i <= 18; $i++){
|
||||||
$scales[] = $scalesBase / pow(2, $i);
|
$scales[] = $scalesBase / pow(2, $i);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->getTileMatrixSet($name, $scales, $corner);
|
return $this->getTileMatrixSet($name, $scales, $corner);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Prints WMTS tilematrixset
|
* Prints WMTS tilematrixset
|
||||||
* @param string $name
|
* @param string $name
|
||||||
@@ -768,7 +768,7 @@ class Wmts extends Server {
|
|||||||
</TileMatrix>';
|
</TileMatrix>';
|
||||||
}
|
}
|
||||||
$TileMatrixSet .= '</TileMatrixSet>';
|
$TileMatrixSet .= '</TileMatrixSet>';
|
||||||
|
|
||||||
return $TileMatrixSet;
|
return $TileMatrixSet;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -830,6 +830,10 @@ class Wmts extends Server {
|
|||||||
</ows:Operation>
|
</ows:Operation>
|
||||||
</ows:OperationsMetadata>
|
</ows:OperationsMetadata>
|
||||||
<Contents>';
|
<Contents>';
|
||||||
|
//TileMatrixSets that will be printed:
|
||||||
|
$tileMatrixSets = array('GoogleMapsCompatible' => FALSE, 'custom' => FALSE, 'geodetic' => FALSE);
|
||||||
|
|
||||||
|
//layers
|
||||||
$maps = array_merge($this->fileLayer, $this->dbLayer);
|
$maps = array_merge($this->fileLayer, $this->dbLayer);
|
||||||
$mercator = new GlobalMercator();
|
$mercator = new GlobalMercator();
|
||||||
foreach ($maps as $m) {
|
foreach ($maps as $m) {
|
||||||
@@ -843,10 +847,18 @@ class Wmts extends Server {
|
|||||||
$bounds = $m['bounds'];
|
$bounds = $m['bounds'];
|
||||||
$format = $m['format'] == 'hybrid' ? 'jpgpng' : $m['format'];
|
$format = $m['format'] == 'hybrid' ? 'jpgpng' : $m['format'];
|
||||||
$mime = ($format == 'jpg') ? 'image/jpeg' : 'image/' . $format;
|
$mime = ($format == 'jpg') ? 'image/jpeg' : 'image/' . $format;
|
||||||
|
|
||||||
if ($profile == 'geodetic') {
|
if ($profile == 'geodetic') {
|
||||||
$tileMatrixSet = "WGS84";
|
$tileMatrixSet = "WGS84";
|
||||||
|
$tileMatrixSets['geodetic'] = TRUE;
|
||||||
|
}elseif ($m['profile'] == 'custom') {
|
||||||
|
$crs = explode(':', $m['crs']);
|
||||||
|
$tileMatrixSet = 'custom' . $crs[1];
|
||||||
|
$tileMatrixSets['custom'] = TRUE;
|
||||||
} else {
|
} else {
|
||||||
$tileMatrixSet = "GoogleMapsCompatible";
|
$tileMatrixSet = "GoogleMapsCompatible";
|
||||||
|
$tileMatrixSets['GoogleMapsCompatible'] = TRUE;
|
||||||
|
|
||||||
list( $minx, $miny ) = $mercator->LatLonToMeters($bounds[1], $bounds[0]);
|
list( $minx, $miny ) = $mercator->LatLonToMeters($bounds[1], $bounds[0]);
|
||||||
list( $maxx, $maxy ) = $mercator->LatLonToMeters($bounds[3], $bounds[2]);
|
list( $maxx, $maxy ) = $mercator->LatLonToMeters($bounds[3], $bounds[2]);
|
||||||
$bounds3857 = array($minx, $miny, $maxx, $maxy);
|
$bounds3857 = array($minx, $miny, $maxx, $maxy);
|
||||||
@@ -874,24 +886,30 @@ class Wmts extends Server {
|
|||||||
<ResourceURL format="' . $mime . '" resourceType="tile" template="' . $resourceUrlTemplate . '"/>
|
<ResourceURL format="' . $mime . '" resourceType="tile" template="' . $resourceUrlTemplate . '"/>
|
||||||
</Layer>';
|
</Layer>';
|
||||||
}
|
}
|
||||||
|
|
||||||
//Print mercator TileMatrixSet
|
if ($tileMatrixSets['geodetic']) {
|
||||||
echo $this->getMercatorTileMatrixSet();
|
//Print wgs84 TileMatrixSet
|
||||||
|
$corner = array(-180.000000, 90.000000);
|
||||||
//Print wgs84 TileMatrixSet
|
$scales = array(279541132.01435887813568115234, 139770566.00717943906784057617,
|
||||||
$name = 'WGS84';
|
|
||||||
$corner = array(-180.000000, 90.000000);
|
|
||||||
$scales = array(279541132.01435887813568115234, 139770566.00717943906784057617,
|
|
||||||
69885283.00358971953392028809, 34942641.50179485976696014404, 17471320.75089742988348007202,
|
69885283.00358971953392028809, 34942641.50179485976696014404, 17471320.75089742988348007202,
|
||||||
8735660.37544871494174003601, 4367830.18772435747087001801, 2183915.09386217873543500900,
|
8735660.37544871494174003601, 4367830.18772435747087001801, 2183915.09386217873543500900,
|
||||||
1091957.54693108936771750450, 545978.77346554468385875225, 272989.38673277234192937613,
|
1091957.54693108936771750450, 545978.77346554468385875225, 272989.38673277234192937613,
|
||||||
136494.69336638617096468806, 68247.34668319308548234403, 34123.67334159654274117202,
|
136494.69336638617096468806, 68247.34668319308548234403, 34123.67334159654274117202,
|
||||||
17061.83667079825318069197, 8530.91833539912659034599, 4265.45916769956329517299,
|
17061.83667079825318069197, 8530.91833539912659034599, 4265.45916769956329517299,
|
||||||
2132.72958384978574031265);
|
2132.72958384978574031265);
|
||||||
$crs = 'EPSG::4326';
|
$crs = 'EPSG::4326';
|
||||||
$matrixRatio = array(2, 1);
|
$matrixRatio = array(2, 1);
|
||||||
|
|
||||||
echo $this->getTileMatrixSet($name, $scales, $corner, $crs, $matrixRatio);
|
echo $this->getTileMatrixSet($tileMatrixSet, $scales, $corner, $crs, $matrixRatio);
|
||||||
|
}
|
||||||
|
if ($tileMatrixSets['custom']) {
|
||||||
|
// Custom from metadata
|
||||||
|
echo $this->getTileMatrixSet($tileMatrixSet, $m['scales'], array($m['projected_bounds'][0], $m['projected_bounds'][4]), $m['crs']);
|
||||||
|
}
|
||||||
|
if($tileMatrixSets['GoogleMapsCompatible']){
|
||||||
|
//Print mercator TileMatrixSet
|
||||||
|
echo $this->getMercatorTileMatrixSet();
|
||||||
|
}
|
||||||
|
|
||||||
echo '</Contents>
|
echo '</Contents>
|
||||||
<ServiceMetadataURL xlink:href="' . $this->config['protocol'] . '://' . $this->config['baseUrls'][0] . '/wmts/1.0.0/WMTSCapabilities.xml"/>
|
<ServiceMetadataURL xlink:href="' . $this->config['protocol'] . '://' . $this->config['baseUrls'][0] . '/wmts/1.0.0/WMTSCapabilities.xml"/>
|
||||||
|
Reference in New Issue
Block a user