[Mapbender-commits] r7846 - branches/2.7/http/classes trunk/mapbender/http/classes

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Thu Jun 9 03:15:49 EDT 2011


Author: verenadiewald
Date: 2011-06-09 00:15:49 -0700 (Thu, 09 Jun 2011)
New Revision: 7846

Modified:
   branches/2.7/http/classes/class_wms.php
   trunk/mapbender/http/classes/class_wms.php
Log:
if layer name is not set, use layer title for getting the supported srs

Modified: branches/2.7/http/classes/class_wms.php
===================================================================
--- branches/2.7/http/classes/class_wms.php	2011-06-08 12:20:25 UTC (rev 7845)
+++ branches/2.7/http/classes/class_wms.php	2011-06-09 07:15:49 UTC (rev 7846)
@@ -1877,11 +1877,16 @@
 		//defining the xpath for getting all Layer-tags
 		$xpathLayerName="//Layer[./Name =\"".$layerName."\"]";
 		
-		$layerObject=$wmsCapXml->xpath($xpathLayerName);
-		
-		//for none named layer (only title is set)	
+        $layerObject=$wmsCapXml->xpath($xpathLayerName);
+
+        //for none named layer (only title is set)	
+        if (empty($layerObject)){
+        	$xpathLayerName="//Layer[./Title =\"".$layerName."\"]";
+            $layerObject=$wmsCapXml->xpath($xpathLayerName);
+        }
+
 		if(!isset($layerObject[0])) {
-			$n = new mb_notice("Layer has no name, BBOX will not be generated for ".$epsg);
+			$n = new mb_notice("Layer has no name and title, BBOX will not be generated for ".$epsg);
 			return false;	
 		}	
 		

Modified: trunk/mapbender/http/classes/class_wms.php
===================================================================
--- trunk/mapbender/http/classes/class_wms.php	2011-06-08 12:20:25 UTC (rev 7845)
+++ trunk/mapbender/http/classes/class_wms.php	2011-06-09 07:15:49 UTC (rev 7846)
@@ -918,15 +918,15 @@
 					$this->objLayer[$cnt_layer]->layer_epsg[$cnt_epsg]["maxx"] = $element[attributes][maxx];
 					$this->objLayer[$cnt_layer]->layer_epsg[$cnt_epsg]["maxy"] = $element[attributes][maxy];
 				}
-				if(mb_strtoupper($element[tag]) == "BOUNDINGBOX" && $element[attributes][SRS] != "EPSG:4326"){
+				if(mb_strtoupper($element[tag]) == "BOUNDINGBOX" && $element[attributes][CRS] != "EPSG:4326"){
 					$cnt_epsg++;
-					$this->objLayer[$cnt_layer]->layer_epsg[$cnt_epsg]["epsg"] = $element[attributes][SRS];
+					$this->objLayer[$cnt_layer]->layer_epsg[$cnt_epsg]["epsg"] = $element[attributes][CRS];
 					$this->objLayer[$cnt_layer]->layer_epsg[$cnt_epsg]["minx"] = $element[attributes][minx];
 					$this->objLayer[$cnt_layer]->layer_epsg[$cnt_epsg]["miny"] = $element[attributes][miny];
 					$this->objLayer[$cnt_layer]->layer_epsg[$cnt_epsg]["maxx"] = $element[attributes][maxx];
 					$this->objLayer[$cnt_layer]->layer_epsg[$cnt_epsg]["maxy"] = $element[attributes][maxy];
 					// a default epsg for mapbender
-					if($cnt_layer == 0 && $this->default_epsg == 0 && mb_strlen(trim($element[attributes][SRS]))>= 10){
+					if($cnt_layer == 0 && $this->default_epsg == 0 && mb_strlen(trim($element[attributes][CRS]))>= 10){
 						$this->default_epsg = $cnt_epsg;
 					}
 				}
@@ -1892,18 +1892,23 @@
 			return false;
        }
 		
-       //layer name from DB
+		//layer name from DB
 		$layerName=$row['layer_name'];
 		//defining the xpath for getting all Layer-tags
 		$xpathLayerName="//Layer[./Name =\"".$layerName."\"]";
 		
-		$layerObject=$wmsCapXml->xpath($xpathLayerName);
-		
-		//for none named layer (only title is set)	
+        $layerObject=$wmsCapXml->xpath($xpathLayerName);
+
+        //for none named layer (only title is set)	
+        if (empty($layerObject)){
+        	$xpathLayerName="//Layer[./Title =\"".$layerName."\"]";
+            $layerObject=$wmsCapXml->xpath($xpathLayerName);
+        }
+
 		if(!isset($layerObject[0])) {
-			$n = new mb_notice("Layer has no name, BBOX will not be generated for ".$epsg);
+			$n = new mb_notice("Layer has no name and title, BBOX will not be generated for ".$epsg);
 			return false;	
-		}	
+		}
 		
 		//search for the SRS tag of specified layer		
 		$srsElementArray=$layerObject[0]->xpath("SRS");



More information about the Mapbender_commits mailing list