[Mapbender-commits] r10075 - trunk/mapbender/http/php

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Mon Mar 18 02:38:26 PDT 2019


Author: armin11
Date: 2019-03-18 02:38:26 -0700 (Mon, 18 Mar 2019)
New Revision: 10075

Modified:
   trunk/mapbender/http/php/wms.php
Log:
Don't set wms scalehint attributes if both are 0 in mapbender database. See wms 1.1.1 spec page 46 - DTD

Modified: trunk/mapbender/http/php/wms.php
===================================================================
--- trunk/mapbender/http/php/wms.php	2019-03-08 21:41:44 UTC (rev 10074)
+++ trunk/mapbender/http/php/wms.php	2019-03-18 09:38:26 UTC (rev 10075)
@@ -1414,12 +1414,21 @@
 			$onlineResource->setAttribute("xlink:type", "simple");
 		}
 	}
-	//Creating "ScaleHint" node
-	if ($layerRow['layer_minscale'] <> "" AND $layerRow['layer_minscale'] <> NULL) {
+	//Creating "ScaleHint" node - as used by wms 1.1.1 - if given, both must exist! wms 1.3.0 demands other logic!
+	if (($layerRow['layer_minscale'] <> "" && $layerRow['layer_minscale'] <> NULL && $layerRow['layer_minscale'] !== '0') || ($layerRow['layer_maxscale'] <> "" && $layerRow['layer_maxscale'] <> NULL && $layerRow['layer_maxscale'] !== '0')) {
 		$scaleHint = $doc->createElement("ScaleHint");
 		$scaleHint = $layer->appendChild($scaleHint);
-		$scaleHint->setAttribute('min', (floatval($layerRow['layer_minscale'])/2004.3976484406788493955738891127));
-		$scaleHint->setAttribute('max', (floatval($layerRow['layer_maxscale'])/2004.3976484406788493955738891127));
+		if ($layerRow['layer_minscale'] <> "" && $layerRow['layer_minscale'] <> NULL && $layerRow['layer_minscale'] !== '0') {
+			$scaleHint->setAttribute('min', (floatval($layerRow['layer_minscale'])/2004.3976484406788493955738891127));
+		} else {
+			$scaleHint->setAttribute('min', 0);
+		}
+		if ($layerRow['layer_maxscale'] <> "" && $layerRow['layer_maxscale'] <> NULL && $layerRow['layer_maxscale'] !== '0' && $layerRow['layer_maxscale'] !== 0) {
+			$scaleHint->setAttribute('max', (floatval($layerRow['layer_maxscale'])/2004.3976484406788493955738891127));
+		} else {
+			//set default to 1000000000!
+			$scaleHint->setAttribute('max', 1000000000 / 2004.3976484406788493955738891127);
+		}
 	}
 	return $layer;	
 } //end of function to create single layer object



More information about the Mapbender_commits mailing list