[Mapbender-commits] r8508 - in trunk/mapbender/http: geoportal img/osgeo_graphics/geosilk php
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Tue Nov 20 07:09:01 PST 2012
Author: armin11
Date: 2012-11-20 07:09:00 -0800 (Tue, 20 Nov 2012)
New Revision: 8508
Added:
trunk/mapbender/http/img/osgeo_graphics/geosilk/raster_download.png
trunk/mapbender/http/img/osgeo_graphics/geosilk/vector_download.png
trunk/mapbender/http/php/mod_getDownloadOptions.php
Modified:
trunk/mapbender/http/geoportal/mod_readCSWResultsDetail.php
trunk/mapbender/http/php/mod_dataISOMetadata.php
trunk/mapbender/http/php/mod_getWmcDisclaimer.php
trunk/mapbender/http/php/mod_showMetadata.php
Log:
Some updates for INSPIRE Download Services via mapbender proxy - not yet ready. Bugfixes for INSPIRE validator - changed url!
Modified: trunk/mapbender/http/geoportal/mod_readCSWResultsDetail.php
===================================================================
--- trunk/mapbender/http/geoportal/mod_readCSWResultsDetail.php 2012-11-19 15:23:35 UTC (rev 8507)
+++ trunk/mapbender/http/geoportal/mod_readCSWResultsDetail.php 2012-11-20 15:09:00 UTC (rev 8508)
@@ -106,7 +106,7 @@
//function to validate against the inspire validation service
function validateInspireMetadataFromData($iso19139Xml){
- $validatorUrl = 'http://www.inspire-geoportal.eu/INSPIREValidatorService/resources/validation/inspire';
+ $validatorUrl = 'http://inspire-geoportal.ec.europa.eu/INSPIREValidatorService/resources/validation/inspire';
#$validatorUrl2 = 'http://localhost/mapbender/x_geoportal/log_requests.php'; //for debugging purposes
//send inspire xml to validator and push the result to requesting user
$validatorInterfaceObject = new connector();
Added: trunk/mapbender/http/img/osgeo_graphics/geosilk/raster_download.png
===================================================================
(Binary files differ)
Property changes on: trunk/mapbender/http/img/osgeo_graphics/geosilk/raster_download.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/mapbender/http/img/osgeo_graphics/geosilk/vector_download.png
===================================================================
(Binary files differ)
Property changes on: trunk/mapbender/http/img/osgeo_graphics/geosilk/vector_download.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Modified: trunk/mapbender/http/php/mod_dataISOMetadata.php
===================================================================
--- trunk/mapbender/http/php/mod_dataISOMetadata.php 2012-11-19 15:23:35 UTC (rev 8507)
+++ trunk/mapbender/http/php/mod_dataISOMetadata.php 2012-11-20 15:09:00 UTC (rev 8508)
@@ -1420,7 +1420,7 @@
//function to validate against the inspire validation service
function validateInspireMetadata($iso19139Doc, $recordId){
- $validatorUrl = 'http://www.inspire-geoportal.eu/INSPIREValidatorService/resources/validation/inspire';
+ $validatorUrl = 'http://inspire-geoportal.ec.europa.eu/INSPIREValidatorService/resources/validation/inspire';
#$validatorUrl2 = 'http://localhost/mapbender/x_geoportal/log_requests.php';
//send inspire xml to validator and push the result to requesting user
$validatorInterfaceObject = new connector();
@@ -1465,7 +1465,7 @@
//function to validate against the inspire validation service
function validateInspireMetadataFromData($iso19139Xml){
- $validatorUrl = 'http://www.inspire-geoportal.eu/INSPIREValidatorService/resources/validation/inspire';
+ $validatorUrl = 'http://inspire-geoportal.ec.europa.eu/INSPIREValidatorService/resources/validation/inspire';
#$validatorUrl2 = 'http://localhost/mapbender/x_geoportal/log_requests.php';
//send inspire xml to validator and push the result to requesting user
$validatorInterfaceObject = new connector();
Added: trunk/mapbender/http/php/mod_getDownloadOptions.php
===================================================================
--- trunk/mapbender/http/php/mod_getDownloadOptions.php (rev 0)
+++ trunk/mapbender/http/php/mod_getDownloadOptions.php 2012-11-20 15:09:00 UTC (rev 8508)
@@ -0,0 +1,113 @@
+<?php
+//2012-11-20-http://localhost/mapbender_trunk/php/mod_getDownloadOptions.php?id=70e0c3e5-707c-f8e1-8037-7b38702176d9&output=xml
+//http://localhost/mapbender_trunk/php/mod_getDownloadOptions.php?id=0a8b7dc8-b198-aac5-9713-79b623a6e651,0395ee4a-f27f-7e71-fc17-65498ffa991c
+
+// http://www.mapbender.org/index.php/
+// Copyright (C) 2002 CCGIS
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2, or (at your option)
+// any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+//Script for pulling all download options for one or more metadataset which are identified by their fileidentifier
+require_once(dirname(__FILE__) . "/../../core/globalSettings.php");
+//require_once(dirname(__FILE__) . "/../classes/class_connector.php");
+//require_once(dirname(__FILE__) . "/../classes/class_administration.php");
+//require_once dirname(__FILE__) . "/../../core/epsg.php";
+require_once(dirname(__FILE__) . "/../classes/class_Uuid.php");
+
+//make all parameters available as upper case
+foreach($_REQUEST as $key => $val) {
+ $_REQUEST[strtoupper($key)] = $val;
+}
+//validate request params
+if (isset($_REQUEST['ID']) & $_REQUEST['ID'] != "") {
+ //validate cs list of uuids or other identifiers - which?
+ $testMatch = $_REQUEST["ID"];
+ //$uuid = new Uuid($testMatch);
+ //$isUuid = $uuid->isValid();
+ $idList = explode(',',$_REQUEST['ID']);
+ for ($i = 0; $i < count($idList); $i++) {
+ $testMatch = $idList[$i];
+ $uuid = new Uuid($testMatch);
+ $isUuid = $uuid->isValid();
+ if (!$isUuid) {
+ echo 'Id: <b>'.$testMatch.'</b> is not a valid uuid (12-4-4-4-8)!<br/>';
+ die();
+ }
+ }
+ $testMatch = NULL;
+}
+
+//define query to pull all download options - actually only the inspire download services based on atom feeds
+
+$sql = "select service_id, resource_id, resource_type, fkey_datalink_id as datalink from (select fkey_wms_id as service_id, layer_id as resource_id, 'layer' as resource_type from layer inner join (select metadata_id, uuid, fkey_layer_id from mb_metadata inner join ows_relation_metadata on ows_relation_metadata.fkey_metadata_id = mb_metadata.metadata_id) ";
+
+$sql .= "as metadata_relation on metadata_relation.fkey_layer_id = layer.layer_id where layer.inspire_download = 1 and metadata_relation.uuid = $1) as layer_metadata LEFT OUTER JOIN ows_relation_data ON layer_metadata.resource_id = ows_relation_data.fkey_layer_id union select fkey_wfs_id as service_id, featuretype_id as resource_id, 'wfs' as resource_type, NULL ";
+
+$sql .= "as datalink from (select wfs_featuretype.featuretype_id ,wfs_featuretype.fkey_wfs_id, wfs_featuretype.inspire_download from wfs_featuretype WHERE inspire_download = 1 ORDER BY featuretype_id) as featuretype_inspire inner join (select metadata_id, uuid, fkey_featuretype_id from mb_metadata inner join ows_relation_metadata on ";
+
+$sql .= "ows_relation_metadata.fkey_metadata_id = mb_metadata.metadata_id) as metadata_relation on metadata_relation.fkey_featuretype_id = featuretype_inspire.featuretype_id and metadata_relation.uuid = $1;";
+
+//initialize array for result
+
+for ($i = 0; $i < count($idList); $i++) {
+ $v = array($idList[$i]);
+ $t = array('s');
+ $res = db_prep_query($sql,$v,$t);
+ //problem, $res don't give back false if it was not successful!
+ //push rows into associative array
+ $j = 0;
+ while ($row = db_fetch_assoc($res)) {
+ //echo "j: ".$j."<br>";
+ switch ($row['resource_type']) {
+ case "wfs":
+ $serviceIdIndex = false;
+ for ($k = 0; $k < count($downloadOptions->{$idList[$i]}->option); $k++) {
+ //echo "k: ".$k."<br>";
+ //echo "service_id: ".$row['service_id']." - searched Id: ".$downloadOptions->{$idList[$i]}->option[$k]->serviceId."<br>";
+ if ($row['service_id'] == $downloadOptions->{$idList[$i]}->option[$k]->serviceId) {
+ //service_id found at index $k
+ $serviceIdIndex = $k;
+ //echo "Service already found on index: ".$serviceIdIndex."<br>";
+ }
+ }
+ if ($serviceIdIndex !== false) {
+ //echo "Add featuretype to given service: ".$serviceIdIndex."<br>";
+ //old wfs has been found
+ //get count of current fts
+ $m = count($downloadOptions->{$idList[$i]}->option[$serviceIdIndex]->featureType);
+ //echo "m: ".$m."<br>";
+ $downloadOptions->{$idList[$i]}->option[$serviceIdIndex]->featureType[$m] = $row['resource_id'];
+ } else {
+ $downloadOptions->{$idList[$i]}->option[$j]->type = "wfsrequest";
+ $downloadOptions->{$idList[$i]}->option[$j]->serviceId = $row['service_id'];
+ $downloadOptions->{$idList[$i]}->option[$j]->featureType[0] = $row['resource_id'];
+ }
+ break;
+ case "layer":
+ if (!isset($row['datalink'] ) || $row['datalink'] == '') {
+ $downloadOptions->{$idList[$i]}->option[$j]->type = "wmslayergetmap";
+ } else {
+ $downloadOptions->{$idList[$i]}->option[$j]->type = "wmslayerdataurl";
+ }
+ $downloadOptions->{$idList[$i]}->option[$j]->serviceId = $row['service_id'];
+ $downloadOptions->{$idList[$i]}->option[$j]->resourceId = $row['resource_id'];
+ $downloadOptions->{$idList[$i]}->option[$j]->dataLink = $row['datalink'];
+ break;
+ }
+ $j++;
+ }
+}
+$result = json_encode($downloadOptions);
+echo $result;
+?>
Modified: trunk/mapbender/http/php/mod_getWmcDisclaimer.php
===================================================================
--- trunk/mapbender/http/php/mod_getWmcDisclaimer.php 2012-11-19 15:23:35 UTC (rev 8507)
+++ trunk/mapbender/http/php/mod_getWmcDisclaimer.php 2012-11-20 15:09:00 UTC (rev 8508)
@@ -81,15 +81,6 @@
$translation['wfs'] = "Web Feature Service";
$translation['noTouInformation'] = 'No informations about terms of use are available!';
}
-
-
-
-
-
-
-
-
-
//javascript:openwindow("../php/mod_showMetadata.php?resource=layer&layout=tabs&redirectToMetadataUrl=1&id=20655");
//Generate wmc document by id
$wmcFactory = new WmcFactory;
@@ -115,8 +106,8 @@
for ($i = 0; $i < $countWMS; $i++) {
$WMS = $validWMS[$countWMS - ($i+1)];
echo $resourceSymbol." <a href='".$mapbenderBaseUrl.$_SERVER['SCRIPT_NAME']."/../mod_showMetadata.php?resource=wms&layout=tabs&id=".$WMS['id']."&languageCode=".$languageCode."'>".$WMS['title']."</a><br>";
-
- $touServiceConnector = new connector($mapbenderProtocol."localhost".$_SERVER['SCRIPT_NAME']."/../mod_getServiceDisclaimer.php?type=wms&id=".$WMS['id']."&languageCode=".$languageCode."&asTable=true");
+ //all local connections are without ssl
+ $touServiceConnector = new connector("http://localhost".$_SERVER['SCRIPT_NAME']."/../mod_getServiceDisclaimer.php?type=wms&id=".$WMS['id']."&languageCode=".$languageCode."&asTable=true");
$touForWMS = $touServiceConnector->file;
//
if ($touForWMS == ''){
@@ -131,12 +122,9 @@
//var_dump($validWMS);
//module to read out all service ids which are stored in mapbender wmc documents and generate a Big Disclaimer for those Docs.
//It integrates all known disclaimers for the used webservices who are stored in the mapbender registry
-
//read out all wms id's
//read out all wfs id's
//generate the disclaimer part for wms
//generate the disclaimer part for wfs
//push disclaimer to json or html
-
-
?>
Modified: trunk/mapbender/http/php/mod_showMetadata.php
===================================================================
--- trunk/mapbender/http/php/mod_showMetadata.php 2012-11-19 15:23:35 UTC (rev 8507)
+++ trunk/mapbender/http/php/mod_showMetadata.php 2012-11-20 15:09:00 UTC (rev 8508)
@@ -200,6 +200,9 @@
$translation['Coupled Metadata'] = "Verknüpfte Metadaten";
$translation['addLayerToMap'] = "Karte im eigenen Viewer anzeigen";
$translation['showMap'] = "Karte anzeigen";
+ $translation['Download GML data from INSPIRE Download Service'] = "Download von GML-Daten über INSPIRE Downloaddienst";
+ $translation['Download raster data from INSPIRE Download Service'] = "Download von Rasterdaten über INSPIRE Downloaddienst";
+
break;
case "en":
$translation['overview'] = 'Overview';
@@ -274,6 +277,8 @@
$translation['Coupled Metadata'] = "Coupled Metadata";
$translation['addLayerToMap'] = "Show map in own viewer";
$translation['showMap'] = "Show map";
+ $translation['Download GML data from INSPIRE Download Service'] = "Download GML data from INSPIRE Download Service";
+ $translation['Download raster data from INSPIRE Download Service'] = "Download raster data from INSPIRE Download Service";
break;
case "fr":
$translation['overview'] = 'Vue générale';
@@ -348,6 +353,8 @@
$translation['Coupled Metadata'] = "Métadonnées couplées";
$translation['addLayerToMap'] = "Ouvrir la carte dans sa propre fenêtre";
$translation['showMap'] = "Ouvrir la carte";
+ $translation['Download GML data from INSPIRE Download Service'] = "Download von GML-Daten über INSPIRE Downloaddienst";
+ $translation['Download raster data from INSPIRE Download Service'] = "Download von Rasterdaten über INSPIRE Downloaddienst";
break;
default: #to english
$translation['overview'] = 'Overview';
@@ -422,6 +429,8 @@
$translation['Coupled Metadata'] = "Coupled Metadata";
$translation['addLayerToMap'] = "Show map in own viewer";
$translation['showMap'] = "Show map";
+ $translation['Download GML data from INSPIRE Download Service'] = "Download GML data from INSPIRE Download Service";
+ $translation['Download raster data from INSPIRE Download Service'] = "Download raster data from INSPIRE Download Service";
}
//Array with infos about the different elements which are shown in the tabs
@@ -1058,26 +1067,25 @@
IN('capabilities','external','metador','upload')
SQL;
$res = db_query($sql);
-
$i = 0;
$metadataList = "";
while ($row = db_fetch_assoc($res)) {
//check for existing download options
- $sqlDownload = <<<SQL
+ /*$sqlDownload = <<<SQL
select count(*) from (select metadata_id as data from (select metadata_id, layer_id from (select fkey_metadata_id, layer_id from layer inner join ows_relation_metadata on layer.layer_id = ows_relation_metadata.fkey_layer_id) as layer_relation
inner join mb_metadata on layer_relation.fkey_metadata_id = mb_metadata.metadata_id where mb_metadata.uuid = $1) as layer_metadata inner join ows_relation_data on ows_relation_data.fkey_layer_id = layer_metadata.layer_id union select mb_metadata.metadata_id as data from mb_metadata right join ows_relation_metadata on mb_metadata.metadata_id = ows_relation_metadata.fkey_metadata_id where mb_metadata.uuid = $1) as foo
-SQL;
+SQL;*/
/*$sqlDownload = <<<SQL
select count(*) from (select mb_metadata.metadata_id as data from mb_metadata right join ows_relation_metadata on mb_metadata.metadata_id = ows_relation_metadata.fkey_metadata_id where mb_metadata.uuid = $1) as foo
SQL;*/
//TODO: INSPIRE Download: It must be tested, if inspire_download is set to 1!!
- $v = array($row["uuid"]);
+/* $v = array($row["uuid"]);
$t = array('s');
$resDownload = db_prep_query($sqlDownload,$v,$t);
$rowDownload = db_fetch_assoc($resDownload);
$e = new mb_notice($rowDownload['count']);
- $e = new mb_notice($row['uuid']);
+ $e = new mb_notice($row['uuid']);*/
//$html .= "<li>";
switch ($row["origin"]) {
@@ -1096,10 +1104,26 @@
default:
break;
}
+ //Pull download options for specific dataset from mapbender database and show them
+ $downloadOptionsConnector = new connector("http://localhost".$_SERVER['SCRIPT_NAME']."/../mod_getDownloadOptions.php?id=".$row["uuid"]);
+ $downloadOptions = json_decode($downloadOptionsConnector->file);
+ //var_dump($downloadOptions);
+
$metadataList .= "<a href='../php/mod_dataISOMetadata.php?outputFormat=iso19139&id=".$row["uuid"]."'>".$row["uuid"]."</a> <a href='../php/mod_dataISOMetadata.php?outputFormat=iso19139&id=".$row["uuid"]."&validate=true'>".$translation['validate']."</a>";
- if (intval($rowDownload['count']) > 0) {
- $metadataList .= "<br><a href='../php/mod_inspireDownloadFeed.php?id=".$row["uuid"]."&type=SERVICE&generateFrom=all'>INSPIRE Download Feed</a><br><a href='../plugins/mb_downloadFeedClient.php?url=".urlencode("http://www.geoportal.rlp.de/mapbender/php/mod_inspireDownloadFeed.php?id=".$row["uuid"]."&type=SERVICE&generateFrom=all")."'>INSPIRE Atom feed client prototype</a>";
+
+ if ($downloadOptions != null) {
+ foreach ($downloadOptions->{$row["uuid"]}->option as $option) {
+ if ($option->type == "wmslayergetmap" || $option->type == "wmslayerdataurl") {
+ //use rastersymbol
+ $metadataList .= " <a href='../plugins/mb_downloadFeedClient.php?url=".urlencode("http://www.geoportal.rlp.de/mapbender/php/mod_inspireDownloadFeed.php?id=".$row["uuid"]."&type=SERVICE&generateFrom=wmslayer&layerid=".$option->resourceId)."'><img src='../img/osgeo_graphics/geosilk/raster_download.png' title='".$translation['Download raster data from INSPIRE Download Service']."'/></a>";
+ } else {
+ //use vectorsymbol
+ $metadataList .= " <a href='../plugins/mb_downloadFeedClient.php?url=".urlencode("http://www.geoportal.rlp.de/mapbender/php/mod_inspireDownloadFeed.php?id=".$row["uuid"]."&type=SERVICE&generateFrom=wfs&wfsid=".$option->serviceId)."'><img src='../img/osgeo_graphics/geosilk/vector_download.png' title='".$translation['Download GML data from INSPIRE Download Service']."'/></a>";
+ }
+
+ }
}
+
$metadataList .= "<br>";
$i++;
}
More information about the Mapbender_commits
mailing list