[Mapbender-commits] r8757 - in trunk/mapbender/http: classes geoportal php plugins

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Wed Jan 8 07:34:04 PST 2014


Author: armin11
Date: 2014-01-08 07:34:04 -0800 (Wed, 08 Jan 2014)
New Revision: 8757

Modified:
   trunk/mapbender/http/classes/class_iso19139.php
   trunk/mapbender/http/geoportal/mod_pullInspireMonitoring.php
   trunk/mapbender/http/php/mod_inspireDownloadFeed.php
   trunk/mapbender/http/plugins/mb_downloadFeedClient.php
Log:
Some bugfixes for external CSW metadata based INSPIRE dls

Modified: trunk/mapbender/http/classes/class_iso19139.php
===================================================================
--- trunk/mapbender/http/classes/class_iso19139.php	2014-01-03 12:46:10 UTC (rev 8756)
+++ trunk/mapbender/http/classes/class_iso19139.php	2014-01-08 15:34:04 UTC (rev 8757)
@@ -215,6 +215,8 @@
 			foreach ($this->keywords as $keyword) {
 				$thesaurusName = $iso19139Xml->xpath('//gmd:MD_Metadata/gmd:identificationInfo/gmd:MD_DataIdentification/gmd:descriptiveKeywords[gmd:MD_Keywords/gmd:keyword/gco:CharacterString="'.$keyword.'"]/gmd:MD_Keywords/gmd:thesaurusName/gmd:CI_Citation/gmd:title/gco:CharacterString');
 				$this->keywordsThesaurusName[$iKeyword] = $thesaurusName[0];
+				//$e = new mb_exception("Keyword: ".$keyword);
+				//$e = new mb_exception("Thesaurus: ".$thesaurusName[0]);
 				//check if keyword is inspire thematic key and add it into mapbenders inspire category
 				if (is_int($inspireCatHash[trim($keyword)])) {
 					$this->inspireCategories[] = $inspireCatHash[trim($keyword)];
@@ -224,6 +226,25 @@
 					//$e = new mb_exception("class_iso19139.php: found entry ".$customCatHash[trim($keyword)]." for custom keyword: ".trim($keyword));
 					$this->customCategories[] = $customCatHash[trim($keyword)];
 				}
+				//extract special keywords for mapbenders proxy and inspire monitoring
+				switch ($this->keywordsThesaurusName[$iKeyword]) {
+					case "mapbender.2.inspireDownload":
+						if ($keyword == "1") {
+							$this->inspireDownload = 1;
+						} else {
+							$this->inspireDownload = 0;
+						}
+						//$e = new mb_exception("inspireDownload: ".$this->inspireDownload);
+					break;
+					case "mapbender.2.inspireWholeArea":
+						$this->inspireWholeArea = $keyword;
+						//$e = new mb_exception("inspireWholeArea: ".$this->inspireWholeArea);
+					break;
+					case "mapbender.2.inspireActualCoverage":
+						$this->inspireActualCoverage = $keyword;
+						//$e = new mb_exception("inspireActualCoverage: ".$this->inspireActualCoverage);
+					break;
+				}
 				unset($thesaurusName);
 				$iKeyword++;
 			}
@@ -251,6 +272,10 @@
 				$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');
+			//$this->downloadLinks = array_values($this->downloadLinks);
+			//$dump = var_export($this->downloadLinks, true);
+			//$e = new mb_exception("type of this->downloadLinks: ".gettype($this->downloadLinks)." - count: ".count($this->downloadLinks)."- obj: - ".$dump);
+			$this->downloadLinks = (array)$this->downloadLinks[0];
 			/*<gmd:extent><gmd:EX_Extent><gmd:geographicElement><gmd:EX_GeographicBoundingBox><gmd:westBoundLongitude><gco:Decimal>5</gco:Decimal></gmd:westBoundLongitude><gmd:eastBoundLongitude><gco:Decimal>10</gco:Decimal></gmd:eastBoundLongitude><gmd:southBoundLatitude><gco:Decimal>48</gco:Decimal></gmd:southBoundLatitude><gmd:northBoundLatitude><gco:Decimal>52</gco:Decimal></gmd:northBoundLatitude></gmd:EX_GeographicBoundingBox></gmd:geographicElement></gmd:EX_Extent></gmd:extent>*/
 			//esri
 			/*<gmd:extent><gmd:EX_Extent><gmd:geographicElement><gmd:EX_GeographicBoundingBox><gmd:westBoundLongitude><gco:Decimal>11.1414</gco:Decimal></gmd:westBoundLongitude><gmd:eastBoundLongitude><gco:Decimal>11.7284</gco:Decimal></gmd:eastBoundLongitude><gmd:southBoundLatitude><gco:Decimal>58.8838</gco:Decimal></gmd:southBoundLatitude><gmd:northBoundLatitude><gco:Decimal>59.2562</gco:Decimal></gmd:northBoundLatitude></gmd:EX_GeographicBoundingBox></gmd:geographicElement><gmd:temporalElement><gmd:EX_TemporalExtent><gmd:extent><gml:TimePeriod gml:id="idNummer1"><gml:beginPosition>1999-05-05</gml:beginPosition><gml:endPosition>2012-04-04</gml:endPosition></gml:TimePeriod></gmd:extent></gmd:EX_TemporalExtent></gmd:temporalElement></gmd:EX_Extent></gmd:extent>*/

Modified: trunk/mapbender/http/geoportal/mod_pullInspireMonitoring.php
===================================================================
--- trunk/mapbender/http/geoportal/mod_pullInspireMonitoring.php	2014-01-03 12:46:10 UTC (rev 8756)
+++ trunk/mapbender/http/geoportal/mod_pullInspireMonitoring.php	2014-01-08 15:34:04 UTC (rev 8757)
@@ -217,30 +217,24 @@
 	$inspireCategories['key'][$row['inspire_category_id']] = $row['inspire_category_key'];
 	$inspireCategories['title'][$row['inspire_category_id']] = $row['inspire_category_code_'.$lang];
 }
+if ($outputFormat == 'monitoring' || $outputFormat == 'table') {
+} else {
 //define sql to do a count of inspire relevant data (metadata)
 $sqlCount = <<<SQL
-select count(metadata_id) as count from (select metadata_id, title from mb_metadata where metadata_id in (select distinct (metadata_id) from (select fkey_metadata_id as metadata_id from ows_relation_metadata inner join (select fkey_layer_id from layer_custom_category where fkey_custom_category_id = $inspireCatId ) as foo on foo.fkey_layer_id = ows_relation_metadata.fkey_layer_id
-union
-select fkey_metadata_id as metadata_id from ows_relation_metadata inner join (select fkey_featuretype_id from wfs_featuretype_custom_category where fkey_custom_category_id = $inspireCatId ) as foo on foo.fkey_featuretype_id = ows_relation_metadata.fkey_featuretype_id
-union
-select fkey_metadata_id as metadata_id from  mb_metadata_custom_category where fkey_custom_category_id = $inspireCatId) as foo ) as foo2) as foo3
-SQL;
 
-$sqlCount2 = <<<SQL
-
-select count(metadata_id) from (select metadata_id, title, uuid from mb_metadata where metadata_id in (select distinct (metadata_id) from (select fkey_metadata_id as metadata_id from ows_relation_metadata inner join (select fkey_layer_id from layer_custom_category where fkey_custom_category_id = $inspireCatId ) as foo on foo.fkey_layer_id = ows_relation_metadata.fkey_layer_id
+select count(metadata_id) from (select distinct (uuid), metadata_id, title,  uuid from mb_metadata where metadata_id in (select distinct (metadata_id) from (select fkey_metadata_id as metadata_id from ows_relation_metadata inner join (select fkey_layer_id from layer_custom_category where fkey_custom_category_id = $inspireCatId ) as foo on foo.fkey_layer_id = ows_relation_metadata.fkey_layer_id
 union
 select fkey_metadata_id as metadata_id from ows_relation_metadata inner join (select fkey_featuretype_id from wfs_featuretype_custom_category where fkey_custom_category_id = $inspireCatId ) as foo on foo.fkey_featuretype_id = ows_relation_metadata.fkey_featuretype_id
 union
 select fkey_metadata_id as metadata_id from  mb_metadata_custom_category where fkey_custom_category_id = $inspireCatId ) as foo )) as foo2 $sWhere
 SQL;
 
-$resultCount = db_query($sqlCount2);
+$resultCount = db_query($sqlCount);
 $rowCount = db_fetch_array($resultCount);
 $resultCount = $rowCount['count'];
 
 $iTotal = $resultCount;
-
+}
 //$e = new mb_exception($rowCount['count']);
 //all inspire relevant data
 
@@ -248,7 +242,22 @@
 //Define sql to select relevant information out of the registry.
 //The direction is from the classified service layer/featuretype information to the coupled metadata.
 //The classifications of the layers are used to decide if the resource is in the outgoing table.
+if ($outputFormat == 'monitoring' || $outputFormat == 'table') {
 $sql = <<<SQL
+
+select metadata_layer.title, metadata_layer.uuid, resource_id, resource_type, service_id, inspire_download, wms_owner as service_owner, fkey_mb_group_id as service_group, wms_title as service_title, f_collect_inspire_cat_layer(resource_id) as inspire_cat from (select title,uuid, layer_id as resource_id, 'layer' as resource_type, fkey_wms_id as service_id, inspire_download from (select layer.layer_id, layer.fkey_wms_id, layer.inspire_download, layer_custom_category.fkey_custom_category_id from layer inner join layer_custom_category on layer.layer_id = layer_custom_category.fkey_layer_id where layer_custom_category.fkey_custom_category_id = $inspireCatId AND layer_searchable = 1 ORDER BY layer_id) as layer_inspire inner join (select metadata_id, uuid, title, fkey_layer_id from mb_metadata inner join ows_relation_metadata on ows_relation_metadata.fkey_metadata_id = mb_metadata.metadata_id) as metadata_relation on metadata_relation.fkey_layer_id = layer_inspire.layer_id) as meta
 data_layer INNER JOIN wms ON metadata_layer.service_id = wms_id  
+
+union 
+
+select metadata_featuretype.title, metadata_featuretype.uuid, resource_id, resource_type, service_id, inspire_download, wfs_owner as service_owner, fkey_mb_group_id as service_group, wfs_title as service_title, f_collect_inspire_cat_wfs_featuretype(resource_id) as inspire_cat from (select title, uuid, featuretype_id as resource_id, 'wfs_featuretype' as resource_type, fkey_wfs_id as service_id, inspire_download from (select wfs_featuretype.featuretype_id ,wfs_featuretype.fkey_wfs_id,  wfs_featuretype.inspire_download from wfs_featuretype) as featuretype_inspire inner join (select metadata_id, uuid, title, fkey_featuretype_id from mb_metadata inner join ows_relation_metadata on ows_relation_metadata.fkey_metadata_id = mb_metadata.metadata_id) as metadata_relation on metadata_relation.fkey_featuretype_id = featuretype_inspire.featuretype_id) as metadata_featuretype INNER JOIN wfs ON metadata_featuretype.service_id = wfs_id 
+order by uuid
+
+SQL;
+
+} else {
+
+
+$sql = <<<SQL
 select distinct (uuid), * from (
 select metadata_layer.title, wms.uuid as service_uuid, wms_title || ':' || layer_title as inspire_service_title, metadata_layer.uuid, metadata_layer.datasetid, metadata_layer.datasetid_codespace, resource_id, resource_uuid, resource_type, service_id, inspire_download, wms_owner as service_owner, fkey_mb_group_id as service_group, wms_title as service_title, f_collect_inspire_cat_layer(resource_id) as inspire_cat from (select title, uuid, datasetid, datasetid_codespace, layer_id as resource_id, 'layer' as resource_type, fkey_wms_id as service_id, inspire_download, layer_title, resource_uuid from (select layer.layer_id, layer.layer_title, layer.fkey_wms_id, layer.uuid as resource_uuid, layer.inspire_download, layer_custom_category.fkey_custom_category_id from layer inner join layer_custom_category on layer.layer_id = layer_custom_category.fkey_layer_id where layer_custom_category.fkey_custom_category_id = $inspireCatId AND layer_searchable = 1 ORDER BY layer_id) as layer_inspi
 re inner join (select metadata_id, datasetid, datasetid_codespace, uuid, title, fkey_layer_id from mb_metadata inner join ows_relation_metadata on ows_relation_metadata.fkey_metadata_id = mb_metadata.metadata_id) as metadata_relation on metadata_relation.fkey_layer_id = layer_inspire.layer_id) as metadata_layer INNER JOIN wms ON metadata_layer.service_id = wms_id   
 
@@ -264,6 +273,8 @@
 ) as foo $sWhere $sOrder $sLimit
 
 SQL;
+
+}
 $startTime = microtime();
 //get all service / owner / fkey_group information for the list of services
 $result = db_query($sql);

Modified: trunk/mapbender/http/php/mod_inspireDownloadFeed.php
===================================================================
--- trunk/mapbender/http/php/mod_inspireDownloadFeed.php	2014-01-03 12:46:10 UTC (rev 8756)
+++ trunk/mapbender/http/php/mod_inspireDownloadFeed.php	2014-01-08 15:34:04 UTC (rev 8757)
@@ -1424,8 +1424,8 @@
 				case "metadata":
 					$downloadLinks = json_decode($mapbenderMetadata[$i]->datalinks);
 					$furtherLink = urldecode($downloadLinks->downloadLinks[0]);
-					$furtherLinkType = $formatsMimetype[$mapbenderMetadata[$m]->format];
-					$furtherLinkTitle = $ressourceTitle." im CRS ".$mapbenderMetadata[$i]->metadata_ref_system."(".$mapbenderMetadata[$m]->format.")";
+					$furtherLinkType = $formatsMimetype[$mapbenderMetadata[$i]->format];
+					$furtherLinkTitle = $ressourceTitle." im CRS ".$mapbenderMetadata[$i]->metadata_ref_system."(".$mapbenderMetadata[$i]->format.")";
 					//generate content link 
 					$feedEntryLink = $feedDoc->createElement("link");
 					$feedEntryLink->setAttribute("rel", "section");
@@ -1708,7 +1708,7 @@
 		$mapbenderMetadata[$indexMapbenderMetadata]->datasetid_codespace = $row['datasetid_codespace'];
 		$mapbenderMetadata[$indexMapbenderMetadata]->metadata_uuid = $row['metadata_uuid'];
 		$mapbenderMetadata[$indexMapbenderMetadata]->metadata_title = $row['metadata_title'];
-		$e = new mb_exception("title: ".$row['metadata_title']);
+		//$e = new mb_exception("title: ".$row['metadata_title']);
 		$mapbenderMetadata[$indexMapbenderMetadata]->metadata_abstract = $row['metadata_abstract'];
 		$mapbenderMetadata[$indexMapbenderMetadata]->accessconstraints = $row['accessconstraints'];//TODO: Let metadata get this from service when created
 		$mapbenderMetadata[$indexMapbenderMetadata]->metadata_uuid = $row['metadata_uuid'];

Modified: trunk/mapbender/http/plugins/mb_downloadFeedClient.php
===================================================================
--- trunk/mapbender/http/plugins/mb_downloadFeedClient.php	2014-01-03 12:46:10 UTC (rev 8756)
+++ trunk/mapbender/http/plugins/mb_downloadFeedClient.php	2014-01-08 15:34:04 UTC (rev 8757)
@@ -28,6 +28,8 @@
 <meta http-equiv="content-style-type" content="text/css" />
 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
 	<link rel="stylesheet" href="../extensions/OpenLayers-2.9.1/theme/default/style.css" type="text/css">
+	<link rel="stylesheet" href="../extensions/OpenLayers-2.9.1/theme/default/style.css" type="text/css">
+	<link type="text/css" href="../extensions/jquery-ui-1.8.16.custom/css/ui-lightness/jquery-ui-1.8.16.custom.css" rel="Stylesheet" />
 	<style type="text/css">
         select, textarea {
             font: 0.9em Verdana, Arial, sans-serif;
@@ -175,6 +177,8 @@
 	<!--<select id="section_file_list" multiple='multiple'>-->
 	<!--<input type="button" title="Download selected files" value="Download selection"/>-->
 	<!--</fieldset>	-->
+	<div id="dialog-modal" title="Download Link">
+</div>
     </div>
 </fieldset>
 



More information about the Mapbender_commits mailing list