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

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Mon May 23 23:21:22 PDT 2016


Author: armin11
Date: 2016-05-23 23:21:21 -0700 (Mon, 23 May 2016)
New Revision: 9473

Modified:
   trunk/mapbender/http/php/mod_showMetadata.php
Log:
Pull extent getmap url from class_administration

Modified: trunk/mapbender/http/php/mod_showMetadata.php
===================================================================
--- trunk/mapbender/http/php/mod_showMetadata.php	2016-05-24 06:20:39 UTC (rev 9472)
+++ trunk/mapbender/http/php/mod_showMetadata.php	2016-05-24 06:21:21 UTC (rev 9473)
@@ -48,7 +48,7 @@
 }
 $e = new mb_notice("mod_showMetadata.php: language in SESSION: ".$sessionLang);
 $e = new mb_notice("mod_showMetadata.php: new language: ".$languageCode);
-
+$admin = new administration();
 $layout = 'tabs';
 //Parse REQUEST Parameters
 if (isset($_REQUEST["resource"]) & $_REQUEST["resource"] != "") {
@@ -994,7 +994,7 @@
 		$epsgString .= $contentBboxes[$j]['epsg']." ";
 		if ($contentBboxes[$j]['epsg'] == 'EPSG:4326') {
 			$wgs84Bbox = $contentBboxes[$j]['minx'].",".$contentBboxes[$j]['miny'].",".$contentBboxes[$j]['maxx'].",".$contentBboxes[$j]['maxy'];
-			$getMapUrl = getExtentGraphic(explode(",", $wgs84Bbox));
+			$getMapUrl = $admin->getExtentGraphic(explode(",", $wgs84Bbox));
 		}
 		
 	}
@@ -1010,7 +1010,7 @@
 	$epsgString .= $resourceMetadata['contentcrs']." ";
 	if ($resourceMetadata['contentcrs'] == 'EPSG:4326') {
 		$wgs84Bbox = $resourceMetadata['contentminx'].",".$resourceMetadata['contentminy'].",".$resourceMetadata['contentmaxx'].",".$resourceMetadata['contentmaxy'];
-		$getMapUrl = getExtentGraphic(explode(",", $wgs84Bbox));
+		$getMapUrl = $admin->getExtentGraphic(explode(",", $wgs84Bbox));
 	} elseif ($resourceMetadata['contentcrs'] != ''){
 		//transform crs
 		$oldEPSG = preg_replace("/EPSG:/","", $resourceMetadata['contentcrs']);
@@ -1027,7 +1027,7 @@
 					"4326"
 				);
 		$wgs84Bbox = round($ll["x"],4).",".round($ll["y"],4).",".round($ur["x"],4).",".round($ur["y"],4);
-		$getMapUrl = getExtentGraphic(explode(",", $wgs84Bbox));
+		$getMapUrl = $admin->getExtentGraphic(explode(",", $wgs84Bbox));
 	}
 $html .= $t_a.$translation['wmccrs'].$t_b.$epsgString.$t_c;
 }
@@ -1059,7 +1059,6 @@
 $html .= $tableEnd;
 //Check if owsproxy is enabled for resource
 if ($resource == 'featuretype' or $resource == 'wfs-conf' or $resource == "wfs") {
-	$admin = new administration();
 	if ($admin->getWFSOWSstring($resourceMetadata['serviceid']) == false) {
 		//
 		//$e = new mb_exception("no proxy");
@@ -1394,39 +1393,6 @@
     return $string;
 } 
 
-function getExtentGraphic($layer_4326_box) {
-		$area_4326_box = explode(',',EXTENTSERVICEBBOX);
-		if ($layer_4326_box[0] <= $area_4326_box[0] || $layer_4326_box[2] >= $area_4326_box[2] || $layer_4326_box[1] <= $area_4326_box[1] || $layer_4326_box[3] >= $area_4326_box[3]) {
-			if ($layer_4326_box[0] < $area_4326_box[0]) {
-				$area_4326_box[0] = $layer_4326_box[0]; 
-			}
-			if ($layer_4326_box[2] > $area_4326_box[2]) {
-				$area_4326_box[2] = $layer_4326_box[2]; 
-			}
-			if ($layer_4326_box[1] < $area_4326_box[1]) {
-				$area_4326_box[1] = $layer_4326_box[1]; 
-			}
-			if ($layer_4326_box[3] > $area_4326_box[3]) {
-				$area_4326_box[3] = $layer_4326_box[3]; 
-			}
-
-			$d_x = $area_4326_box[2] - $area_4326_box[0]; 
-			$d_y = $area_4326_box[3] - $area_4326_box[1];
-			
-			$new_minx = $area_4326_box[0] - 0.05*($d_x);
-			$new_maxx = $area_4326_box[2] + 0.05*($d_x);
-			$new_miny = $area_4326_box[1] - 0.05*($d_y);
-			$new_maxy = $area_4326_box[3] + 0.05*($d_y);
-
-			if ($new_minx < -180) $area_4326_box[0] = -180; else $area_4326_box[0] = $new_minx;
-			if ($new_maxx > 180) $area_4326_box[2] = 180; else $area_4326_box[2] = $new_maxx;
-			if ($new_miny < -90) $area_4326_box[1] = -90; else $area_4326_box[1] = $new_miny;
-			if ($new_maxy > 90) $area_4326_box[3] = 90; else $area_4326_box[3] = $new_maxy;
-		}
-		$getMapUrl = EXTENTSERVICEURL."VERSION=1.1.1&REQUEST=GetMap&SERVICE=WMS&LAYERS=".EXTENTSERVICELAYER."&STYLES=&SRS=EPSG:4326&BBOX=".$area_4326_box[0].",".$area_4326_box[1].",".$area_4326_box[2].",".$area_4326_box[3]."&WIDTH=120&HEIGHT=120&FORMAT=image/png&BGCOLOR=0xffffff&TRANSPARENT=TRUE&EXCEPTIONS=application/vnd.ogc.se_inimage&minx=".$layer_4326_box[0]."&miny=".$layer_4326_box[1]."&maxx=".$layer_4326_box[2]."&maxy=".$layer_4326_box[3];
-		return $getMapUrl;
-}
-
 //from php/mod_coordsLookup_server.php
 function transform ($x, $y, $oldEPSG, $newEPSG) {
 	if (is_null($x) || !is_numeric($x) || 



More information about the Mapbender_commits mailing list