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

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Tue Oct 28 06:58:59 PDT 2014


Author: armin11
Date: 2014-10-28 06:58:59 -0700 (Tue, 28 Oct 2014)
New Revision: 9113

Modified:
   trunk/mapbender/http/classes/class_iso19139.php
Log:
Enhancement for handling transferSize of ISO19139

Modified: trunk/mapbender/http/classes/class_iso19139.php
===================================================================
--- trunk/mapbender/http/classes/class_iso19139.php	2014-10-28 11:16:38 UTC (rev 9112)
+++ trunk/mapbender/http/classes/class_iso19139.php	2014-10-28 13:58:59 UTC (rev 9113)
@@ -38,6 +38,7 @@
 	var $inspireCategories = array();
 	var $customCategories = array();
 	var $downloadLinks = array();  //store in db as json object!!!!
+	var $transferSize;
 	var $hierachyLevel;
 	var $tmpExtentBegin;
 	var $tmpExtentEnd;
@@ -112,6 +113,7 @@
 		$this->inspireDownload = 0;
 		$this->linkAlreadyInDB = false;
 		$this->fileIdentifierAlreadyInDB = false;
+		$this->transferSize = null;
 	}
 
 	public function removeGetRecordTag ($xml) {
@@ -279,6 +281,18 @@
 				$e = new mb_exception("class_iso19139.php: customcat: ".$category);
 			}*/
 			$this->downloadLinks = $iso19139Xml->xpath('//gmd:MD_Metadata/gmd:distributionInfo/gmd:MD_Distribution/gmd:transferOptions/gmd:MD_DigitalTransferOptions/gmd:onLine/gmd:CI_OnlineResource[gmd:function/gmd:CI_OnLineFunctionCode/@codeListValue="download"]/gmd:linkage/gmd:URL');
+			//volume of dataset when transfered via online access - in megabyte (real) - see iso19139
+			/*
+			<gmd:transferSize>
+   				<gco:Real>1.0</gco:Real>
+			</gmd:transferSize>
+			*/
+			$this->transferSize = $iso19139Xml->xpath('//gmd:MD_Metadata/gmd:distributionInfo/gmd:MD_Distribution/gmd:transferOptions/gmd:MD_DigitalTransferOptions/gmd:transferSize/gco:Real');
+			if (isset($this->transferSize[0]) && $this->transferSize[0] !=='') {
+				$this->transferSize = $this->transferSize[0];
+			} else {
+				$this->transferSize = null;
+			}		
 			//$e = new mb_exception("class_iso19139.php: count of downloadlinks: ".count($this->downloadLinks));
 			//$this->downloadLinks = array_values($this->downloadLinks);
 			//$dump = var_export($this->downloadLinks, true);
@@ -1559,8 +1573,9 @@
 
 	public function insertMetadataIntoDB() {
 		//insert an instance for iso19139 into mapbenders database
+		$e = new mb_exception("class_iso19139.php: insert metadata with title: ".$this->title);
 		$sql = <<<SQL
-INSERT INTO mb_metadata (lastchanged, link, origin, md_format, data, linktype, uuid, title, createdate, changedate, abstract, searchtext, type, tmp_reference_1, tmp_reference_2, export2csw, datasetid, datasetid_codespace, randomid, fkey_mb_user_id, harvestresult, harvestexception, lineage, inspire_top_consistence, spatial_res_type, spatial_res_value, update_frequency, format, inspire_charset, ref_system, the_geom, datalinks, inspire_whole_area, inspire_actual_coverage, inspire_download, bounding_geom)  VALUES(now(), $1, $18, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $19, $20, $21, $22, $23, $24, $25, $26, $27, $28, $29, $30, $31, $32, $33, $34, $35)
+INSERT INTO mb_metadata (lastchanged, link, origin, md_format, data, linktype, uuid, title, createdate, changedate, abstract, searchtext, type, tmp_reference_1, tmp_reference_2, export2csw, datasetid, datasetid_codespace, randomid, fkey_mb_user_id, harvestresult, harvestexception, lineage, inspire_top_consistence, spatial_res_type, spatial_res_value, update_frequency, format, inspire_charset, ref_system, the_geom, datalinks, inspire_whole_area, inspire_actual_coverage, inspire_download, bounding_geom)  VALUES(now(), $1, $18, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $19, $20, $21, $22, $23, $24, $25, $26, $27, $28, $29, $30, $31, $32, $33, $34, $35, $36)
 SQL;
 		$v = array(
 			$this->href,
@@ -1597,9 +1612,10 @@
 			$this->inspireWholeArea,
 			$this->inspireActualCoverage,
 			$this->inspireDownload,
-			$this->createWktPolygonFromPointArray($this->polygonalExtentExterior)
+			$this->createWktPolygonFromPointArray($this->polygonalExtentExterior),
+			$this->transferSize
 		);
-			$t = array('s','s','s','s','s','s','s','s','s','s','s','s','s','b','s','s','s','s','i','i','s','s','b','s','s','s','s','s','s','POLYGON','s','s','s','i','POLYGON');
+			$t = array('s','s','s','s','s','s','s','s','s','s','s','s','s','b','s','s','s','s','i','i','s','s','b','s','s','s','s','s','s','POLYGON','s','s','s','i','POLYGON','d');
 			$res = db_prep_query($sql,$v,$t);
 			return $res;
 	}
@@ -1642,7 +1658,7 @@
 		$sql .= "linktype = $4, uuid = $5, title = $6, createdate = $7, changedate = $8, lastchanged = now(), ";
 		$sql .= "abstract = $9, searchtext = $10, type = $11, tmp_reference_1 = $12, tmp_reference_2 = $13, export2csw = $14, datasetid = $15, ";
 		$sql .= "datasetid_codespace = $16, randomid = $17, harvestresult = $20, harvestexception = $21, lineage = $22, inspire_top_consistence = $23, ";
-		$sql .= "spatial_res_type = $24, spatial_res_value = $25, update_frequency = $26, format = $27, inspire_charset = $28, ref_system = $29, the_geom = $30, datalinks = $31, inspire_whole_area = $32, inspire_actual_coverage = $33, inspire_download = $34, bounding_geom = $35 WHERE metadata_id = $19";
+		$sql .= "spatial_res_type = $24, spatial_res_value = $25, update_frequency = $26, format = $27, inspire_charset = $28, ref_system = $29, the_geom = $30, datalinks = $31, inspire_whole_area = $32, inspire_actual_coverage = $33, inspire_download = $34, bounding_geom = $35, transfer_size = $36 WHERE metadata_id = $19";
 		//$e= new mb_exception("class_iso19139.php: downloadLinks json".$this->jsonEncodeDownloadLinks($this->downloadLinks));
 		//$e= new mb_exception("class_iso19139.php: downloadLinks[0]".$this->downloadLinks[0]);
 		$v = array(
@@ -1681,9 +1697,10 @@
 			$this->inspireWholeArea,
 			$this->inspireActualCoverage,
 			$this->inspireDownload,
-			$this->createWktPolygonFromPointArray($this->polygonalExtentExterior)
+			$this->createWktPolygonFromPointArray($this->polygonalExtentExterior),
+			$this->transferSize
 		);
-		$t = array('s','s','s','s','s','s','s','s','s','s','s','s','s','b','s','s','s','s','i','i','s','s','b','s','s','s','s','s','s','POLYGON','s','s','s','i','POLYGON');
+		$t = array('s','s','s','s','s','s','s','s','s','s','s','s','s','b','s','s','s','s','i','i','s','s','b','s','s','s','s','s','s','POLYGON','s','s','s','i','POLYGON','d');
 		$res = db_prep_query($sql,$v,$t);
 		return $res;
 	}



More information about the Mapbender_commits mailing list