[Mapbender-commits] r9599 - in trunk/mapbender/http: classes php
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Tue Sep 20 01:32:43 PDT 2016
Author: armin11
Date: 2016-09-20 01:32:43 -0700 (Tue, 20 Sep 2016)
New Revision: 9599
Modified:
trunk/mapbender/http/classes/class_wmc.php
trunk/mapbender/http/classes/class_wms.php
trunk/mapbender/http/php/mod_transformTimeDimension.php
Log:
Some improvements for handling wms dimension parameter. Wmc information is now updated on load with dimension information from database. Some wms handle this dynamic - layer dimension information may change every day!
Modified: trunk/mapbender/http/classes/class_wmc.php
===================================================================
--- trunk/mapbender/http/classes/class_wmc.php 2016-09-19 15:21:56 UTC (rev 9598)
+++ trunk/mapbender/http/classes/class_wmc.php 2016-09-20 08:32:43 UTC (rev 9599)
@@ -608,7 +608,22 @@
$style[$row["fkey_layer_id"]][$row["name"]] [$row["legendurlformat"]] = $row["legendurl"];
//$e = new mb_notice($row["fkey_layer_id"] . " : " . $row["name"]. " - legendurl: ".$row["legendurl"]." - format: ".$row["legendurlformat"]);
}
- //$e = new mb_exception("after style");
+ //pull all information about dimension - first only this information, that makes sense
+ $sql = "SELECT * FROM layer_dimension WHERE fkey_layer_id IN (";
+ $sql .= $layerList;
+ $sql .= ") AND (name = 'time' AND units = 'ISO8601')";
+ //$sql .= ") AND (name = 'time' or name = 'elevation')";
+ //following attributes should be exchanged for time:
+ $attributeNames = array('unitSymbol', 'default', 'multipleValues', 'nearestValue', 'current', 'extent');
+ $resStyle = db_prep_query($sql,$v,$t);
+ //get result as array
+ $dimension = array();
+ while($row = db_fetch_array($resStyle)) {
+ foreach ($attributeNames as $attributeName) {
+ $dimension[$row["fkey_layer_id"]][$row["name"]] [$attributeName] = $row[strtolower($attributeName)];
+ //$e = new mb_exception($row["fkey_layer_id"] . " : " . $row["name"]. " - attributeName: ".$attributeName." - value from db: ".$row[strtolower($attributeName)]);
+ }
+ }
//for each found layer
while($row = db_fetch_array($res)){
$wmsId = $row["fkey_wms_id"];
@@ -758,6 +773,14 @@
}
}
}
+ foreach($layerDoc->xpath('/Layer/DimensionList/Dimension[@name="time" and @units="ISO8601"]') as $dimensionObject) {
+ foreach ($attributeNames as $attributeName) {
+ //$e = new mb_exception("set ".$attributeName." attribute of dimension object to ".$dimension[(integer)$layerId]["time"][$attributeName]);
+ $resultOfXpath = reset($WMCDoc->xpath("/wmc:ViewContext/wmc:LayerList/wmc:Layer[wmc:Extension/mapbender:layer_id='".(integer)$layerId."']/wmc:DimensionList/wmc:Dimension[@name=\"time\" and @units=\"ISO8601\"]/@".$attributeName));
+ $resultOfXpath->{0} = $dimension[(integer)$layerId]["time"][$attributeName];
+
+ }
+ }
}
}
$updatedWMC = $WMCDoc->saveXML();
@@ -1319,7 +1342,7 @@
$featuretypeConfArray = is_string($wfsConfIds) ?
explode(",", $wfsConfIds) : array();
for ($i = 0; $i < count($featuretypeConfArray); $i++) {
- $wfsconf = new WfsConf();
+ $wfsconf = new WfsConf();
$featuretypeConf = $wfsconf->getWfsConfFromDb($featuretypeConfArray[$i]);
array_push($featuretypeConfs,$featuretypeConf);
}
Modified: trunk/mapbender/http/classes/class_wms.php
===================================================================
--- trunk/mapbender/http/classes/class_wms.php 2016-09-19 15:21:56 UTC (rev 9598)
+++ trunk/mapbender/http/classes/class_wms.php 2016-09-20 08:32:43 UTC (rev 9599)
@@ -3829,7 +3829,7 @@
$t = array('i');
$res_dimension = db_prep_query($sql,$v,$t);
$count_layer_dimension = 0;
- $e = new mb_exception("classes/class_wms.php - select dimension from database (createObjFromDBNoGui)!");
+ //$e = new mb_exception("classes/class_wms.php - select dimension from database (createObjFromDBNoGui)!");
while($row_dim = db_fetch_array($res_dimension)) {
$attributeNames = array('name', 'units', 'unitSymbol', 'default', 'multipleValues', 'nearestValue', 'current', 'extent');
foreach($attributeNames as $attribute) {
Modified: trunk/mapbender/http/php/mod_transformTimeDimension.php
===================================================================
--- trunk/mapbender/http/php/mod_transformTimeDimension.php 2016-09-19 15:21:56 UTC (rev 9598)
+++ trunk/mapbender/http/php/mod_transformTimeDimension.php 2016-09-20 08:32:43 UTC (rev 9599)
@@ -267,7 +267,7 @@
//check extent for single year entries
if (preg_match($singleYearPattern,$interval[0]) && preg_match($singleYearPattern,$interval[1])) {
$fullYearExtent = true;
- $e = new mb_exception("single year pattern");
+ //$e = new mb_exception("single year pattern");
//set to middle of the year
$interval[0] = $interval[0]."-07-02";
$interval[1] = $interval[1]."-07-02";
More information about the Mapbender_commits
mailing list