[Mapbender-commits] r8735 - in trunk/mapbender/http: classes geoportal

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Sun Nov 3 11:23:51 PST 2013


Author: armin11
Date: 2013-11-03 11:23:51 -0800 (Sun, 03 Nov 2013)
New Revision: 8735

Modified:
   trunk/mapbender/http/classes/class_iso19139.php
   trunk/mapbender/http/geoportal/mod_pullInspireMonitoring.php
Log:
Bugfix for parsing metadata xml files

Modified: trunk/mapbender/http/classes/class_iso19139.php
===================================================================
--- trunk/mapbender/http/classes/class_iso19139.php	2013-10-31 08:39:40 UTC (rev 8734)
+++ trunk/mapbender/http/classes/class_iso19139.php	2013-11-03 19:23:51 UTC (rev 8735)
@@ -163,6 +163,15 @@
 				//$e = new mb_exception("customCatHash: ".$row['custom_category_key'] ." : ". $row['custom_category_id'] );	
 			}
 			//add namespaces to xml if not given - how? - it is to late now - maybe they were given in the csw tag!
+			//only parse the MD_Metadata part ;-)
+			$iso19139Xml->registerXPathNamespace("gmd", "http://www.isotc211.org/2005/gmd");
+			$iso19139Xml->registerXPathNamespace("gco", "http://www.isotc211.org/2005/gco");
+			$iso19139Xml->registerXPathNamespace("gml", "http://www.opengis.net/gml");
+			//$iso19139Xml->registerXPathNamespace("ogc", "http://www.opengis.net/ogc");
+			$iso19139Xml->registerXPathNamespace("xlink", "http://www.w3.org/1999/xlink");
+			$iso19139Xml->registerXPathNamespace("xsi", "http://www.w3.org/2001/XMLSchema-instance");
+			$iso19139Xml->registerXPathNamespace("default", "");
+			//TODO: use md_metadata element before xpath
 			$e = new mb_notice("Parsing of xml metadata file was successfull"); 
 			$this->fileIdentifier = $iso19139Xml->xpath('//gmd:MD_Metadata/gmd:fileIdentifier/gco:CharacterString');
 			$this->fileIdentifier = $this->fileIdentifier[0];
@@ -311,8 +320,6 @@
 	}
 
 	public function transformToHtml($layout,$languageCode){
-		//TODO!
-		//$this->metadata = $this->removeGetRecordTag($this->metadata);
 		libxml_use_internal_errors(true);
 		//TODO don't parse it again, but change the internal parser function!
 		try {
@@ -343,8 +350,6 @@
 			$iso19139Xml->registerXPathNamespace("xlink", "http://www.w3.org/1999/xlink");
 			include(dirname(__FILE__)."/../../conf/isoMetadata.conf");
 			for($a = 0; $a < count($iso19139Hash); $a++) {
-				//TODO delete csw:... from following - only parse the metadata record itself
-				//$resultOfXpath = $iso19139Xml->xpath('/csw:GetRecordByIdResponse'.$iso19139Hash[$a]['iso19139']);
 				$resultOfXpath = $iso19139Xml->xpath("/".$iso19139Hash[$a]['iso19139']);
 				for ($i = 0; $i < count($resultOfXpath); $i++) {
 					$iso19139Hash[$a]['value'] = $iso19139Hash[$a]['value'].",".$resultOfXpath[$i];
@@ -1023,15 +1028,18 @@
 		}
 	}
 	
-	private function createWktBboxFromArray($bboxArray) {
+	private function createWktBboxFromArray($bboxArray) { //-180 -90 180 90 
 		$postGisBbox = "";
+		if (count($bboxArray) != 4 || $bboxArray[0] == '') {
+			//create dummy bbox
+			//$e = new mb_exception("class_iso19139.php: bbox: ".$postGisBbox);
+			$bboxArray = array(-180,-90,180,90);
+		}
 		//"SRID=4326;POLYGON((-140 -80,-140 80,170 80,170 -80,-140 -80))"
 		$postGisBbox = "SRID=4326;POLYGON((".$bboxArray[0]." ".$bboxArray[1].",".$bboxArray[0]." ".$bboxArray[3].",".$bboxArray[2]." ".$bboxArray[3].",".$bboxArray[2]." ".$bboxArray[1].",".$bboxArray[0]." ".$bboxArray[1]."))";
-		//$e = new mb_exception("class_iso19139.php: bbox: ".$postGisBbox);
 		return $postGisBbox;
 	}
 
-
 	public function insertKeywordsAndCategoriesIntoDB($metadataId,$resourceType,$resourceId){
 		//first delete old classifications - after that create new ones
 		$this->deleteKeywordsAndCategoriesFromDB($metadataId,$resourceType,$resourceId);

Modified: trunk/mapbender/http/geoportal/mod_pullInspireMonitoring.php
===================================================================
--- trunk/mapbender/http/geoportal/mod_pullInspireMonitoring.php	2013-10-31 08:39:40 UTC (rev 8734)
+++ trunk/mapbender/http/geoportal/mod_pullInspireMonitoring.php	2013-11-03 19:23:51 UTC (rev 8735)
@@ -18,7 +18,7 @@
 require_once(dirname(__FILE__)."/../../core/globalSettings.php");
 require_once dirname(__FILE__)."/../classes/class_connector.php";
 require_once dirname(__FILE__) . "/../classes/class_Uuid.php";
-$inspireCatId = 1;
+$inspireCatId = 11;
 $outputFormat = 'json';
 $lang = 'de';
 $registratingDepartments = null;



More information about the Mapbender_commits mailing list