[Mapbender-commits] r9472 - trunk/mapbender/http/classes

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Mon May 23 23:20:39 PDT 2016


Author: armin11
Date: 2016-05-23 23:20:39 -0700 (Mon, 23 May 2016)
New Revision: 9472

Modified:
   trunk/mapbender/http/classes/class_administration.php
   trunk/mapbender/http/classes/class_metadata_new.php
Log:
Push extent getmapgenerator to class_administration, make class_metadata_new somewhat faster

Modified: trunk/mapbender/http/classes/class_administration.php
===================================================================
--- trunk/mapbender/http/classes/class_administration.php	2016-05-23 13:56:21 UTC (rev 9471)
+++ trunk/mapbender/http/classes/class_administration.php	2016-05-24 06:20:39 UTC (rev 9472)
@@ -19,6 +19,7 @@
 require_once(dirname(__FILE__)."/../../core/globalSettings.php");
 require_once(dirname(__FILE__)."/class_user.php");
 require_once(dirname(__FILE__)."/class_cache.php");
+require_once dirname(__FILE__) . "/../../tools/wms_extent/extent_service.conf";
 require(dirname(__FILE__) . "/phpmailer-1.72/class.phpmailer.php");
 
 /**
@@ -668,6 +669,47 @@
      * @return string|boolean	either the wmc as string or false when none exists
      * @deprecated
      */
+
+	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;
+	}
+
+    /**
+     * selects the WMC for a given wmc_id.
+     *
+     * @param integer			the wms id
+     * @return string|boolean	either the wmc as string or false when none exists
+     * @deprecated
+     */
 	function getWmcById($id){
 		$e = new mb_notice("administration->getWmcById is deprecated, use wmc->getDocument instead!"); 
 

Modified: trunk/mapbender/http/classes/class_metadata_new.php
===================================================================
--- trunk/mapbender/http/classes/class_metadata_new.php	2016-05-23 13:56:21 UTC (rev 9471)
+++ trunk/mapbender/http/classes/class_metadata_new.php	2016-05-24 06:20:39 UTC (rev 9472)
@@ -1,18 +1,17 @@
 <?php
 #Script to call this class: http://www.geoportal.rlp.de/mapbender/php/mod_callMetadata.php
 #Class for getting results out of the mapbender service registry 
-#Resulttypes: WMS, WMS-Layer, (WFS), WFS-Featurtyps, WFS-Conf, WMC, GeoRSS-Feeds, ...
+#Resulttypes: WMS, WMS-Layer, (WFS), WFS-Featurtyps, WFS-Conf, WMC, Datasets, ...
 #Possible filters: registrating organizations, time, bbox (fully inside, intersects, fully outside), ISO Topic Categories, INSPIRE themes, INSPIRE: keywords, classification of data/service ... - maybe relevant for the german broker not for one instance, quality and actuality (maybe spatial and temporal), bbox, deegree of conformity with ir, access and use constraints, responsible parties - maybe one is enough? We must have a look at the INSPIRE Metadata IR
 #Metadata we need to fullfil the demands of INSPIRE:
 #1. INSPIRE conformity classification for WMS/WFS/WCS
 #2. Temporal Extents at WMS/WMS-Layer/WFS/WFS-Featuretype levels - for datasets if demanded - til now there is no demand defined in the guidance-paper for metadata ir
 #3. Classified access and use contraints - which classes? - Check IR Data Sharing and IR Metadata
 #4. 
-#Every ressource which should be send to INSPIRE can be filtered - but is not neccessary for a standardized approach
+#Every resource which should be send to INSPIRE can be filtered - but is not neccessary for a standardized approach
 #Another problem is the ranking of the different ressources. The ranking should be homogeneus. 
 #Till now we rank the using of WMS Layers when Caps are requested and when s.o. load one layer into the geoportal.
-#The same things have to be done for the wfs-conf, wmc and georssfeeds
-#The searching for metadata should be parallel done. We need different classes for doing the search. They should be requested by one central class (class_metadata.php).
+#TODO: The same things have to be done for the wfs-conf (Modules). Actually the invocation of inspire atom feeds are counted. Also the invocation of WMC documents are monitored. 
 #Classes for filtering after the results have been send to the portal:
 #1. ISO Topic Categories
 #2. INSPIRE Themes
@@ -61,7 +60,7 @@
 	var $resourceIds;
 	var $restrictToOpenData;
 	var $originFromHeader;
-	var $resolveCoupledResources;
+	var $resolveCoupledResources; //only for class of dataset metadata - it pulls the coupled ressources (ogc-services : wms-layer/wfs-featuretypes)
 
 	function __construct($userId, $searchId, $searchText, $registratingDepartments, $isoCategories, $inspireThemes, $timeBegin, $timeEnd, $regTimeBegin, $regTimeEnd, $maxResults, $searchBbox, $searchTypeBbox, $accessRestrictions, $languageCode, $searchEPSG, $searchResources, $searchPages, $outputFormat, $resultTarget, $searchURL, $customCategories, $hostName, $orderBy, $resourceIds, $restrictToOpenData, $originFromHeader, $resolveCoupledResources = false){
 		$this->userId = (integer)$userId;
@@ -654,9 +653,13 @@
 			$layerSearchArray = array();
 			$featuretypeSearchArray = array();
 			$downloadOptionsArray = array();
-			if (count($allCoupledLayers) >= 1) {
+			$uniqueAllCoupledLayers = array_unique($allCoupledLayers);
+			$uniqueAllCoupledFeaturetypes = array_unique($allCoupledFeaturetypes);
+			$countUniqueLayers = count($uniqueAllCoupledLayers);
+			$countUniqueFeaturetypes = count($uniqueAllCoupledFeaturetypes);
+			if ($countUniqueLayers >= 1) {
 				//$e = new mb_exception("invoke search");
-				$coupledLayers = new self($this->userId, 'dummysearch', '*', null, null, null, null, null, null, null, count(array_unique($allCoupledLayers)), null, null, null, $this->languageCode, null, 'wms', 1, 'json', 'internal', null, null, $this->hostName, 'rank',implode(',',array_unique($allCoupledLayers)) ,false , null);
+				$coupledLayers = new self($this->userId, 'dummysearch', '*', null, null, null, null, null, null, null, $countUniqueLayers, null, null, null, $this->languageCode, null, 'wms', 1, 'json', 'internal', null, null, $this->hostName, 'rank',implode(',',$uniqueAllCoupledLayers) ,false , null);
 				$srvCount = 0;				
 				foreach (json_decode($coupledLayers->internalResult)->wms->srv as $server) {			
 					//$e = new mb_exception("server id ->". $server->id);
@@ -684,9 +687,9 @@
 				}
 			}
 			//$e = new mb_exception("count featuretypes: ".time());
-			if (count($allCoupledFeaturetypes) >= 1) {
+			if ($countUniqueFeaturetypes >= 1) {
 				//$e = new mb_exception("some ft found");
-				$coupledFeaturetypes = new self($this->userId, 'dummysearch', '*', null, null, null, null, null, null, null, count(array_unique($allCoupledFeaturetypes)), null, null, null, $this->languageCode, null, 'wfs', 1, 'json', 'internal', null, null, $this->hostName, 'rank', implode(',',array_unique($allCoupledFeaturetypes)) ,false , null);
+				$coupledFeaturetypes = new self($this->userId, 'dummysearch', '*', null, null, null, null, null, null, null, $countUniqueFeaturetypes, null, null, null, $this->languageCode, null, 'wfs', 1, 'json', 'internal', null, null, $this->hostName, 'rank', implode(',',$uniqueAllCoupledFeaturetypes),false , null);
 				//$e = new mb_exception("featuretype: ".$coupledFeaturetypes->internalResult);	
 				$srvCount = 0;				
 				foreach (json_decode($coupledFeaturetypes->internalResult)->wfs->srv as $server) {



More information about the Mapbender_commits mailing list