mirror of
https://github.com/klokantech/tileserver-php.git
synced 2025-08-08 07:36:28 +02:00
Order of origin coords based on proj4 definition #70
This commit is contained in:
@@ -734,7 +734,13 @@ class Wmts extends Server {
|
|||||||
* @return Object
|
* @return Object
|
||||||
*/
|
*/
|
||||||
public function parseTileMatrix($layer, $tileMatrix){
|
public function parseTileMatrix($layer, $tileMatrix){
|
||||||
|
|
||||||
|
//process projection
|
||||||
|
if(isset($layer['proj4'])){
|
||||||
|
preg_match_all("/([^+= ]+)=([^= ]+)/", $layer['proj4'], $res);
|
||||||
|
$proj4 = array_combine($res[1], $res[2]);
|
||||||
|
}
|
||||||
|
|
||||||
for($i = 0; $i < count($tileMatrix); $i++){
|
for($i = 0; $i < count($tileMatrix); $i++){
|
||||||
|
|
||||||
if(!isset($tileMatrix[$i]['id'])){
|
if(!isset($tileMatrix[$i]['id'])){
|
||||||
@@ -760,11 +766,8 @@ class Wmts extends Server {
|
|||||||
$tileMatrix[$i]['extent'][0], $tileMatrix[$i]['extent'][3]
|
$tileMatrix[$i]['extent'][0], $tileMatrix[$i]['extent'][3]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (!isset($layer['axis'])) {
|
|
||||||
$layer['axis'] = $layer['xy'];
|
|
||||||
}
|
|
||||||
// Origins of geographic coordinate systems are setting in opposite order
|
// Origins of geographic coordinate systems are setting in opposite order
|
||||||
if ($layer['axis'] == 'yx') {
|
if (isset($proj4) && $proj4['proj'] === 'longlat') {
|
||||||
$tileMatrix[$i]['origin'] = array_reverse($tileMatrix[$i]['origin']);
|
$tileMatrix[$i]['origin'] = array_reverse($tileMatrix[$i]['origin']);
|
||||||
}
|
}
|
||||||
if(!isset($tileMatrix[$i]['scale_denominator'])){
|
if(!isset($tileMatrix[$i]['scale_denominator'])){
|
||||||
@@ -907,7 +910,7 @@ class Wmts extends Server {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
header('Content-type: application/xml');
|
header('Content-type: application/xml');
|
||||||
echo '<?xml version="1.0" encoding="UTF-8" ?>
|
echo '<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
<Capabilities xmlns="http://www.opengis.net/wmts/1.0" xmlns:ows="http://www.opengis.net/ows/1.1" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:gml="http://www.opengis.net/gml" xsi:schemaLocation="http://www.opengis.net/wmts/1.0 http://schemas.opengis.net/wmts/1.0/wmtsGetCapabilities_response.xsd" version="1.0.0">
|
<Capabilities xmlns="http://www.opengis.net/wmts/1.0" xmlns:ows="http://www.opengis.net/ows/1.1" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:gml="http://www.opengis.net/gml" xsi:schemaLocation="http://www.opengis.net/wmts/1.0 http://schemas.opengis.net/wmts/1.0/wmtsGetCapabilities_response.xsd" version="1.0.0">
|
||||||
|
Reference in New Issue
Block a user