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

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Fri Jun 28 02:08:18 PDT 2019


Author: armin11
Date: 2019-06-28 02:08:17 -0700 (Fri, 28 Jun 2019)
New Revision: 10166

Modified:
   trunk/mapbender/http/php/mod_getCoupledResourcesForDataset.php
Log:
Fix data service coupling resolver if getrecordbyid give back resource which is not dataset or series

Modified: trunk/mapbender/http/php/mod_getCoupledResourcesForDataset.php
===================================================================
--- trunk/mapbender/http/php/mod_getCoupledResourcesForDataset.php	2019-06-27 12:42:57 UTC (rev 10165)
+++ trunk/mapbender/http/php/mod_getCoupledResourcesForDataset.php	2019-06-28 09:08:17 UTC (rev 10166)
@@ -169,11 +169,11 @@
 	$outputFormat = $testMatch;
 	$testMatch = NULL;
 }
+
 //instantiate
 $mbMetadata = new Iso19139();
 //initialize if resource is based on a request to csw interface
 $cswBasedResource = false;
-
 //test if getrecordbyid request was used - then the service data may also be in the same catalogue
 if (strpos(strtoupper($url), "GETRECORDBYID") !== false && strpos(strtoupper($url), "SERVICE=CSW") !== false && strpos(strtoupper($url), "VERSION=2.0.2") !== false) {
 	$cswBasedResource = true;
@@ -186,7 +186,15 @@
 //build search request for services
 //TODO: test if this ok - maybe not everything is parsed by class? instead we could use $mbMetadata->readFromUrl($url);
 //$e = new mb_exception("php/mod_getCoupledResourcesForDataset.php: url for getrecordbyid: ".$url);
-$mbMetadata->createFromUrl($url);
+//$mbMetadata->createFromUrl($url);
+
+if ($mbMetadata->createFromUrl($url) == false) {
+	$resultObj['message'] ='Could not get metadata by getrecordbyid request!'; 
+	$resultObj['result'] = null;
+	echo json_encode($resultObj);
+	die(); 
+}
+
 //$e = new mb_exception("php/mod_getCoupledResourcesForDataset.php: datasetid from getrecordbyid: ".$mbMetadata->datasetIdCodeSpace.$mbMetadata->datasetId);
 $serviceMetadata = new stdClass();
 $serviceMetadataIndex = 0;
@@ -308,5 +316,10 @@
 		echo json_encode($resultObj);
 		die(); 	
 	}
+} else {
+	$resultObj['message'] ='Hierarchy level of ISO metadata is '.$mbMetadata->hierarchyLevel.' - not dataset or series!'; 
+	$resultObj['result'] = null;
+	echo json_encode($resultObj);
+	die(); 
 }
 ?>



More information about the Mapbender_commits mailing list