[Mapbender-commits] r8386 - trunk/mapbender/http/php
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Tue Jun 19 08:12:44 PDT 2012
Author: armin11
Date: 2012-06-19 08:12:44 -0700 (Tue, 19 Jun 2012)
New Revision: 8386
Removed:
trunk/mapbender/http/php/mod_inspireWmsDownloadFeed.php
Modified:
trunk/mapbender/http/php/mod_inspireDownloadFeed.php
trunk/mapbender/http/php/mod_showMetadata.php
Log:
Bugfixes for INSPIRE predefined download services for wms/wfs by usage of georss feeds - need little further work.
Modified: trunk/mapbender/http/php/mod_inspireDownloadFeed.php
===================================================================
--- trunk/mapbender/http/php/mod_inspireDownloadFeed.php 2012-06-18 20:48:30 UTC (rev 8385)
+++ trunk/mapbender/http/php/mod_inspireDownloadFeed.php 2012-06-19 15:12:44 UTC (rev 8386)
@@ -339,6 +339,7 @@
$ressourceTitle = "Title of dataset cannot be found!";
}
}
+
//first use metadata abstract then layer abstract
if (isset($mapbenderMetadata[$m]->metadata_abstract) && $mapbenderMetadata[$m]->metadata_abstract != '' ) {
@@ -357,9 +358,9 @@
$feedTitle = $feedDoc->createElement("title");
//$feedTitle->setAttribute("xml:lang", "de");
if ($type == 'SERVICE') {
- $feedTitleText = $feedDoc->createTextNode("INSPIRE Download Service Feed für ".$ressourceTitle);
+ $feedTitleText = $feedDoc->createTextNode("INSPIRE Download Service Feed fuer ".$ressourceTitle);
} else { //DATASET
- $feedTitleText = $feedDoc->createTextNode("INSPIRE Datensatz Feed für ".$ressourceTitle);
+ $feedTitleText = $feedDoc->createTextNode("INSPIRE Datensatz Feed fuer ".$ressourceTitle);
}
$feedTitle->appendChild($feedTitleText);
$feed->appendChild($feedTitle);
@@ -435,7 +436,7 @@
$feedLink->setAttribute("rel", "describedby");
$feedLink->setAttribute("type", "text/html");
$feedLink->setAttribute("hreflang", "de");
- $feedLink->setAttribute("title", "Nähere Beschreibung des Datensatzes");
+ $feedLink->setAttribute("title", "Naehere Beschreibung des Datensatzes");
$feed->appendChild($feedLink);
}
//5.1.6 - 5.1.7
@@ -668,7 +669,11 @@
//echo "maxyWms: ". $maxyWms .",";
$bboxWfs[$mapbenderMetadata[$i]->featuretype_name][$countBbox] = $minxWfs.",".$minyWfs.",".$maxxWfs.",".$maxyWfs;
//transform bbox back to geographic coordinates
- $featureTypeBboxWGS84[] = transformBbox($minxWfs.",".$minyWfs.",".$maxxWfs.",".$maxyWfs,intval($epsgId[1]),4326);
+ $lonLatBbox = transformBbox($minxWfs.",".$minyWfs.",".$maxxWfs.",".$maxyWfs,intval($epsgId[1]),4326);
+ $lonLatBbox = explode(',',$lonLatBbox);
+ $featureTypeBboxWGS84[] = $lonLatBbox[1].",".$lonLatBbox[0].",".$lonLatBbox[3].",".$lonLatBbox[2];
+ //switch bbox to lat/lon cause inspire demands ist
+
//$e = new mb_exception($test);
$countBbox++;
@@ -734,10 +739,10 @@
$ressourceServiceFeedEntryTitle = $ressourceTitle." - generiert aus WMS Capabilities dataURL Element";
break;
case "wfs":
- $ressourceServiceFeedEntryTitle = $ressourceTitle." - generiert über WFS GetFeature Aufrufe";
+ $ressourceServiceFeedEntryTitle = $ressourceTitle." - generiert ueber WFS GetFeature Aufrufe";
break;
}
- $feedEntryTitle->appendChild($feedDoc->createTextNode("Feed Entry für: ".$ressourceServiceFeedEntryTitle)); //TODO: maybe add some category?
+ $feedEntryTitle->appendChild($feedDoc->createTextNode("Feed Entry fuer: ".$ressourceServiceFeedEntryTitle)); //TODO: maybe add some category?
} else {
switch ($mapbenderMetadata[$i]->origin) {
case "wmslayer":
@@ -747,7 +752,7 @@
$ressourceDataFeedEntryTitle = $ressourceTitle." - generiert aus WMS Capabilities dataURL Element";
break;
case "wfs":
- $ressourceDataFeedEntryTitle = $ressourceTitle." - generiert über WFS GetFeature Aufrufe";
+ $ressourceDataFeedEntryTitle = $ressourceTitle." - generiert ueber WFS GetFeature Aufrufe";
break;
}
$feedEntryTitle->appendChild($feedDoc->createTextNode($ressourceDataFeedEntryTitle. " im CRS ".$mapbenderMetadata[$i]->metadata_ref_system." und Format ".$mapbenderMetadata[$i]->format)); //TODO: maybe add some category?
@@ -901,7 +906,7 @@
//<summary>This is the entry for water network ABC Dataset</summary>
if ($type == 'SERVICE') {
$feedEntrySummary = $feedDoc->createElement("summary");
- $feedEntrySummary->appendChild($feedDoc->createTextNode("Nähere Beschreibung des Feedinhaltes: ".$ressourceAbstract));
+ $feedEntrySummary->appendChild($feedDoc->createTextNode("Naehere Beschreibung des Feedinhaltes: ".$ressourceAbstract));
$feedEntry->appendChild($feedEntrySummary);
}
@@ -910,9 +915,12 @@
//<georss:polygon>47.202 5.755 55.183 5.755 55.183 15.253 47.202 15.253 47.202 5.755</georss:polygon>
//TODO: Get this out of mb_metadata! If not given get it from layer bbox - but normally they should be identical!
$feedEntryBbox = $feedDoc->createElement("georss:polygon");
- $georssPolygon = $mapbenderMetadata[$i]->minx." ".$mapbenderMetadata[$i]->miny." ".$mapbenderMetadata[$i]->maxx." ".$mapbenderMetadata[$i]->miny." ";
- $georssPolygon .= $mapbenderMetadata[$i]->maxx." ".$mapbenderMetadata[$i]->maxy." ".$mapbenderMetadata[$i]->minx." ".$mapbenderMetadata[$i]->maxy." ";
- $georssPolygon .= $mapbenderMetadata[$i]->minx." ".$mapbenderMetadata[$i]->miny;
+ $e = new mb_exception('mapbender minx: '.$mapbenderMetadata[$i]->minx);
+ $e = new mb_exception('mapbender i: '.$i);
+ $e = new mb_exception('mapbender origin: '.$mapbenderMetadata[$i]->origin);
+ $georssPolygon = $mapbenderMetadata[$i]->miny." ".$mapbenderMetadata[$i]->minx." ".$mapbenderMetadata[$i]->maxy." ".$mapbenderMetadata[$i]->minx." ";
+ $georssPolygon .= $mapbenderMetadata[$i]->maxy." ".$mapbenderMetadata[$i]->maxx." ".$mapbenderMetadata[$i]->miny." ".$mapbenderMetadata[$i]->maxx." ";
+ $georssPolygon .= $mapbenderMetadata[$i]->miny." ".$mapbenderMetadata[$i]->minx;
$feedEntryBbox->appendChild($feedDoc->createTextNode($georssPolygon));
$feedEntry->appendChild($feedEntryBbox);
@@ -1052,7 +1060,7 @@
$mapbenderMetadata[$indexMapbenderMetadata]->datasetid_codespace = METADATA_DEFAULT_CODESPACE;
$mapbenderMetadata[$indexMapbenderMetadata]->datasetid = $mapbenderMetadata[$indexMapbenderMetadata]->metadata_uuid;
}
- if ($generateFrom == "wfs") {
+ if ($generateFrom == "wfs" or $mapbenderMetadata[$indexMapbenderMetadata]->origin == "wfs") {
$latlonbbox = explode(",",$mapbenderMetadata[$indexMapbenderMetadata]->latlonbbox);
$mapbenderMetadata[$indexMapbenderMetadata]->minx = $latlonbbox[0];
$mapbenderMetadata[$indexMapbenderMetadata]->miny = $latlonbbox[1];
Deleted: trunk/mapbender/http/php/mod_inspireWmsDownloadFeed.php
===================================================================
--- trunk/mapbender/http/php/mod_inspireWmsDownloadFeed.php 2012-06-18 20:48:30 UTC (rev 8385)
+++ trunk/mapbender/http/php/mod_inspireWmsDownloadFeed.php 2012-06-19 15:12:44 UTC (rev 8386)
@@ -1,650 +0,0 @@
-<?php
-//http://www.geoportal.rlp.de/mapbender/php/mod_inspireWmsDownloadFeed.php?ID=20578&type=SERVICE
-//http://www.geoportal.rlp.de/mapbender/php/mod_inspireWmsDownloadFeed.php?ID=20578&type=DATASET
-//http://localhost/mapbender/php/mod_inspireWmsDownloadFeed.php?ID=20578&type=DATASET
-//http://localhost/mapbender/php/mod_inspireWmsDownloadFeed.php?ID=20648&type=SERVICE
-//20648
-// $Id: mod_inspireWmsDownloadFeed.php 235
-// 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 to generate a feed for a predefined dataset download as it is demanded in the INSPIRE Download Service guidance 3.0 from 04.05.2012. It will be generated from given wms layers dataurl attributs which are registrated in the mapbender database. The other possibility is, that the wms are used to built the download links. Therefore the wms must support the generation of image/tiff output format with geotiff tags. Many wms do this. These wms must also support a minimum of 1000x1000 pixel for a single getmap request. It works as a webservice. The requested id is the mapbender layers serial id.
-
-require_once(dirname(__FILE__) . "/../../core/globalSettings.php");
-require_once(dirname(__FILE__) . "/../classes/class_connector.php");
-require_once(dirname(__FILE__) . "/../classes/class_administration.php");
-
-$con = db_connect(DBSERVER,OWNER,PW);
-db_select_db(DB,$con);
-
-$admin = new administration();
-
-$imageResolution = 100;
-
-$maxImageSize = 1000;
-
-//pull the needed things from tables datalink, md_metadata, layer, wms
-
-//parse request parameter
-//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 integer
- $testMatch = $_REQUEST["ID"];
- $pattern = '/^[\d]*$/';
- if (!preg_match($pattern,$testMatch)){
- echo 'Id: <b>'.$testMatch.'</b> is not valid.<br/>';
- die();
- }
- $recordId = $testMatch;
- $testMatch = NULL;
-}
-
-if (!isset($_REQUEST['TYPE']) || $_REQUEST['TYPE'] == "") {
- echo '<b>Mandatory parameter type is not set!</b><br>Please set type to <b>DATASET</b> or <b>SERVICE</b>';
- die();
-}
-
-//validate request params
-if (isset($_REQUEST['TYPE']) & $_REQUEST['TYPE'] != "") {
- //validate type
- $testMatch = $_REQUEST["TYPE"];
- if ($testMatch != 'SERVICE' && $testMatch != 'DATASET'){
- echo 'type: <b>'.$testMatch.'</b> is not valid.<br/>';
- die();
- }
- $type = $testMatch;
- $testMatch = NULL;
-}
-
-
-//Initialize XML document
-$feedDoc = new DOMDocument('1.0');
-$feedDoc->encoding = 'UTF-8';
-
-
-//Feed Example from the Guidance Paper 3.0 page 33/34
-//
-/*
-<!-- Example "Download Service Feed" -->
-<feed xmlns="http://www.w3.org/2005/Atom" xmlns:georss="http://www.georss.org/georss" xml:lang="en"> <!-- feed title -->
-<title>XYZ Example INSPIRE Download Service</title>
-<!-- feed subtitle -->
-<subtitle>INSPIRE Download Service of organisation XYZ providing Hydrography data</subtitle>
-<!-- link to service ISO 19139 metadata -->
-<link href="http://xyz.org/metadata/iso19139_document.xml" rel="describedby" type=”application/xml”/>
-<!-- self-referencing link to this feed -->
-<link href="http://xyz.org/download/en.xml" rel="self" type="application/atom+xml" hreflang="en" title="This document"/>
-<!-- link to Open Search definition file for this service-->
-<link rel="search" href="http://xyz.org/search/opensearchdescription.xml" type="application/opensearchdescription+xml" title="Open Search Description for XYZ download service"/>
-<!-- link to this feed in another language -->
-<link href="http://xyz.org/download/de.xml" rel="alternate" type="application/atom+xml" hreflang="de" title="The download service information in German"/> <!-- link to another representation of this feed (HTML) -->
-<link href="http://xyz.org/download/index.html" rel="alternate" type="text/html" hreflang="en" title="An HTML version of this document"/> <!-- link to this feed in HTML in another language-->
-<link href="http://xyz.org/download/index.de.html" rel="alternate" type="text/html" hreflang="de" title="An HTML version of this document in German"/>
-<!-- identifier -->
-<id>http://xyz.org/download/en.xml</id>
-<!-- rights, access restrictions --> <rights>Copyright (c) 2012, XYZ; all rights reserved</rights>
-<!-- date/time this feed was last updated -->
-<updated>2012-03-31T13:45:03Z</updated>
-<!-- author contact information --> <author>
-<name>John Doe</name> <email>doe at xyz.org</email>
-</author>
-<!-- entry for a "Dataset Feed" for a pre-defined dataset -->
-<entry>
-<!-- title for "Dataset Feed" for pre-defined dataset -->
-<title>Water network ABC Dataset Feed</title>
-<!-- link to "Dataset Feed" for pre-defined dataset -->
-<link rel="alternate" href="http://xyz.org/data/waternetwork_feed.xml" type="application/atom+xml" hreflang="en" title="Feed containing the pre-defined waternetwork dataset (in one or more downloadable formats)"/>
-<!-- identifier for "Dataset Feed" for pre-defined dataset -->
-<id>http://xyz.org/data/waternetwork_feed.xml</id>
-<!-- rights, access info for pre-defined dataset -->
-<rights>Copyright (c) 2002-2011, XYZ; all rights reserved</rights>
-<!-- last date/time this entry was updated -->
-<updated>2012-03-31T13:45:03Z</updated>
-<!-- summary -->
-<summary>This is the entry for water network ABC Dataset</summary>
-<!-- optional GeoRSS-Simple polygon outlining the bounding box of the pre-defined dataset described by the entry. Must be lat lon --> <georss:polygon>47.202 5.755 55.183 5.755 55.183 15.253 55.183 5.755 47.202 5.755</georss:polygon>
-<!-- CRSs in which the pre-defined Dataset is available -->
-<category term="EPSG:25832" scheme="http://www.opengis.net/def/crs/" label="EPSG/0/25832"/>
-<category term="EPSG:4258" scheme="http://www.opengis.net/def/crs/" label="EPSG/0/4258"/>
-</entry>
-<!-- Any number of "Dataset Feeds" for different pre-defined datasets may be added here as separate entries -->
-</feed>
-*/
-
-//Some needfull functions to pull metadata out of the database.
-//List of data which is needed to build the feed:
-//header part ******
-// - feed title: Generated from dataset name - either mb_metadata.title or layer.layer_title
-// - feed subtitle: Generated from dataset name - either mb_metadata.title or layer.layer_title, organisation name - mapbender group information (metadata contact) - cause it is generated from data of a registrated wms
-// - link to ISO19139 service metadata - this will be created dynamically by given layer_id as this script itself
-// - link to opensearch description for this download service - as before the layer_id will be used as a parameter
-// - id - link to the script itself
-// - rights - the access constraints of the view service are used - they should also give information about the access constraints for the usage of the data
-// - updated : last date the feed was updated - use current timestamp of the wms as the feed will be generated from dataurl entry of the layer object - wms.wms_timestamp
-//datalink.random_id - this is newly created when layers are updated ! - new
-//author - use information from mapbender group - metadata point of contact - registrating organization
-//entry part ******
-// - entry title: Generated from dataset name - either mb_metadata.title or layer.layer_title - in combination e.g. with "Feed for ..."
-// - link to the dataset feed - invoked by layer id as this is done before
-// - summary - Generated by some infomation: mb_metadata.format, mb_metadata.ref_sytem, ...., datalink.datalink_format
-// - updated - timestamp of wms as done before
-// -
-
-function generateFeed($feedDoc, $recordId, $generateFromDataurl = false) {
- global $admin, $type, $imageResolution, $maxImageSize;
-
-
- if ($generateFromDataurl) {
-
- $sql = <<<SQL
-
-select * from (select * from (select * from (select * from (select mb_metadata.metadata_id, layer_relation.layer_name, layer_relation.fkey_wms_id, layer_relation.layer_id, mb_metadata.uuid as metadata_uuid, mb_metadata.format,mb_metadata.title as metadata_title, mb_metadata.abstract as metadata_abstract, layer_relation.layer_title, layer_relation.layer_abstract, mb_metadata.ref_system as metadata_ref_system, mb_metadata.datasetid, mb_metadata.spatial_res_type, mb_metadata.spatial_res_value from (select * from layer inner join ows_relation_metadata on layer.layer_id = ows_relation_metadata.fkey_layer_id where layer.layer_id = $1) as layer_relation inner join mb_metadata on layer_relation.fkey_metadata_id = mb_metadata.metadata_id) as layer_metadata inner join ows_relation_data on ows_relation_data.fkey_layer_id = layer_metadata.layer_id) as layer_relation_data inner join datalink on layer_relation_data.fkey_datalink_id = datalink.datalink_id) as layer_data inner join wms on
layer_data.fkey_wms_id = wms.wms_id) as layer_wms, layer_epsg where layer_wms.layer_id = layer_epsg.fkey_layer_id and layer_epsg.epsg = 'EPSG:4326';
-
-SQL;
- } else { //dataurl is not given, therefor don't ask for such an entry ;-)
-
- $sql = <<<SQL
-
-select * from (select * from (select mb_metadata.metadata_id, layer_relation.layer_name, layer_relation.fkey_wms_id, layer_relation.layer_id, mb_metadata.uuid as metadata_uuid, mb_metadata.format,mb_metadata.title as metadata_title, mb_metadata.abstract as metadata_abstract, layer_relation.layer_title, layer_relation.layer_abstract, mb_metadata.ref_system as metadata_ref_system, mb_metadata.datasetid, mb_metadata.spatial_res_type, mb_metadata.spatial_res_value from (select * from layer inner join ows_relation_metadata on layer.layer_id = ows_relation_metadata.fkey_layer_id where layer.layer_id = $1) as layer_relation inner join mb_metadata on layer_relation.fkey_metadata_id = mb_metadata.metadata_id) layer_data inner join wms on layer_data.fkey_wms_id = wms.wms_id) as layer_wms, layer_epsg where layer_wms.layer_id = layer_epsg.fkey_layer_id and layer_epsg.epsg = 'EPSG:4326';
-
-SQL;
-
- }
-
- $v = array((integer)$recordId);
- $t = array('i');
- $res = db_prep_query($sql,$v,$t);
- $mapbenderMetadata = db_fetch_array($res);
-
-
- if ($generateFromDataurl) {
- //check if layer_id datalink_id and metadata_id are given and not empty!
- if (!isset($mapbenderMetadata['datalink_id']) || $mapbenderMetadata['datalink_id'] == '') {
- return "<error>No dataurl element is given for the requested wms layer</error>";
- }
- }
- //TODO - if the wms is a raster based wms and the output format may be geotiff - the feed entries can be generated automatically. We need following information
- // 1. a raster based wms is given or not - checkbox at metadata editor!
- // 2. geotiff maybe one of the allowed formats! - layer format
- // 3. the maximum of pixel which can be served by the wms - maybe 2000x2000px - metadata editor!
- // 4. The scale hints maybe used to control if a special get map request will produce a picture or not
- //TODO: In this case we have to generate a feed for every single getmap request. This feed have to be called dynamically too! It will be cool to have the bboxes as get parameter or give a index of the bbox with which the bbox can be calculated again!
-
- if (!isset($mapbenderMetadata['metadata_id']) || $mapbenderMetadata['metadata_id'] == '') {
- return "<error>The requested wms layer has no coupled metadataset</error>";
- }
- //if (!isset($mapbenderMetadata['datalink_id'] || $mapbenderMetadata['datalink_id'] == '') {
- // return "<error>The requested wms layer has no coupled metadataset</error>";
- //}
- $crs = $mapbenderMetadata['metadata_ref_system'];
- $epsgId = explode(':',$crs);
- //Get other needed information out of mapbender database (if not already defined in the select above):
- //service data
- if ($wmsView != '') {
- $sql = "SELECT contactorganization, contactelectronicmailaddress ";
- $sql .= "FROM wms WHERE wms_id = $1";
- $v = array((integer)$mapbenderMetadata['wms_id']);
- $t = array('i');
- $res = db_prep_query($sql,$v,$t);
- $serviceMetadata = db_fetch_array($res);
- }
- //infos about the registrating department, check first if a special metadata point of contact is defined in the service table - function from mod_showMetadata - TODO: should be defined in admin class
- if (!isset($mapbenderMetadata['fkey_mb_group_id']) or is_null($mapbenderMetadata['fkey_mb_group_id']) or $mapbenderMetadata['fkey_mb_group_id'] == 0){
- $e = new mb_exception("mod_inspireWmsDownloadFeed.php: fkey_mb_group_id not found!");
- //Get information about owning user of the relation mb_user_mb_group - alternatively the defined fkey_mb_group_id from the service must be used!
- $sqlDep = "SELECT mb_group_name, mb_group_title, mb_group_id, mb_group_logo_path, mb_group_address, mb_group_email, mb_group_postcode, mb_group_city, mb_group_voicetelephone, mb_group_facsimiletelephone FROM mb_group AS a, mb_user AS b, mb_user_mb_group AS c WHERE b.mb_user_id = $1 AND b.mb_user_id = c.fkey_mb_user_id AND c.fkey_mb_group_id = a.mb_group_id AND c.mb_user_mb_group_type=2 LIMIT 1";
- $vDep = array($mapbenderMetadata['wms_owner']);
- $tDep = array('i');
- $resDep = db_prep_query($sqlDep, $vDep, $tDep);
- $departmentMetadata = db_fetch_array($resDep);
- } else {
- $e = new mb_exception("mod_inspireWmsDownloadFeed.php: fkey_mb_group_id found!");
- $sqlDep = "SELECT mb_group_name , mb_group_title, mb_group_id, mb_group_logo_path , mb_group_address, mb_group_email, mb_group_postcode, mb_group_city, mb_group_voicetelephone, mb_group_facsimiletelephone FROM mb_group WHERE mb_group_id = $1 LIMIT 1";
- $vDep = array($mapbenderMetadata['fkey_mb_group_id']);
- $tDep = array('i');
- $resDep = db_prep_query($sqlDep, $vDep, $tDep);
- $departmentMetadata = db_fetch_array($resDep);
- }
-
- //infos about the owner of the service - he is the man who administrate the metadata - register the service
- $sql = "SELECT mb_user_email ";
- $sql .= "FROM mb_user WHERE mb_user_id = $1";
- $v = array((integer)$mapbenderMetadata['wms_owner']);
- $t = array('i');
- $res = db_prep_query($sql,$v,$t);
- $userMetadata = db_fetch_array($res);
- $generateFromDataurl = false;
-
- //check if resource is freely available to anonymous user - which are all users who search thru metadata catalogues:
- $hasPermission=$admin->getLayerPermission($mapbenderMetadata['fkey_wms_id'],$mapbenderMetadata['layer_name'],PUBLIC_USER);
-
- $feed = $feedDoc->createElementNS('http://www.w3.org/2005/Atom', 'feed');
- $feed = $feedDoc->appendChild($feed);
- //$feed->setAttribute("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance");
- $feed->setAttribute("xmlns:georss", "http://www.georss.org/georss");
- //echo "<test>".$mapbenderMetadata['fkey_wms_id'].":".$mapbenderMetadata['wms_owner']."</test>";
- //qualifying id of the referenced ressource: Either dataset id or the id of the metadata record
- if (isset($mapbenderMetadata["datasetid"]) && $mapbenderMetadata["datasetid"] != '' ) {
- $ressourceId = $mapbenderMetadata["datasetid"];
- } else {
- if (isset($mapbenderMetadata["metadata_uuid"]) && $mapbenderMetadata["metadata_uuid"] != '' ) {
- $ressourceId = $mapbenderMetadata["metadata_uuid"];
- } else {
- $ressourceId = "ID of dataset cannot be found!";
- }
- }
-
- //first use metadata title then layer title
- if (isset($mapbenderMetadata["metadata_title"]) && $mapbenderMetadata["metadata_title"] != '' ) {
- $ressourceTitle = $mapbenderMetadata["metadata_title"];
- } else {
- if (isset($mapbenderMetadata["layer_title"]) && $mapbenderMetadata["layer_title"] != '' ) {
- $ressourceTitle = $mapbenderMetadata["layer_title"];
- } else {
- $ressourceTitle = "Title of dataset cannot be found!";
- }
- }
-
- //first use metadata abstract then layer abstract
- if (isset($mapbenderMetadata["metadata_abstract"]) && $mapbenderMetadata["metadata_abstract"] != '' ) {
- $ressourceAbstract = $mapbenderMetadata["metadata_abstract"];
- } else {
- if (isset($mapbenderMetadata["layer_abstract"]) && $mapbenderMetadata["layer_abstract"] != '' ) {
- $ressourceAbstract = $mapbenderMetadata["layer_abstract"];
- } else {
- $ressourceAbstract = "Abstract of dataset cannot be found!";
- }
- }
-
-
- //feed title - 5.1.1 / 5.2
- //<title>XYZ Example INSPIRE Download Service</title>
- //<title>XYZ Example INSPIRE Dataset ABC Download</title>
- $feedTitle = $feedDoc->createElement("title");
- //$feedTitle->setAttribute("xml:lang", "de");
- //echo "<error>".$type."</error>";
- //return;
- if ($type == 'SERVICE') {
- $feedTitleText = $feedDoc->createTextNode("INSPIRE Download Service: ".$ressourceTitle);
- } else { //DATASET
- $feedTitleText = $feedDoc->createTextNode("INSPIRE Datensatz Download: ".$ressourceTitle);
- }
- $feedTitle->appendChild($feedTitleText);
- $feed->appendChild($feedTitle);
-
- //feed subtitle - 5.1.2 / 5.2
- //<subtitle xml:lang="en">INSPIRE Download Service of organisation XYZ providing a data set for the Hydrography theme</subtitle>
- //<subtitle>INSPIRE Download Service, of organisation XYZ providing dataset ABC for the Hydrography theme</subtitle>
- $feedSubTitle = $feedDoc->createElement("subtitle");
- //$feedSubTitle->setAttribute("xml:lang", "de");
- if ($type == 'SERVICE') {
- $feedSubTitleText = $feedDoc->createTextNode("INSPIRE Download Service von ".$departmentMetadata['mb_group_title']."");
- } else { //DATASET
- $feedSubTitleText = $feedDoc->createTextNode("INSPIRE Download Service von: ".$departmentMetadata['mb_group_title']." zur Bereitstellung des Datensatzes: ".$ressourceTitle);
- }
-
- $feedSubTitle->appendChild($feedSubTitleText);
- $feed->appendChild($feedSubTitle);
-
- //links
-
- //metadata
- //service metadata - 5.1.3 / dataset metadata 5.2.1
- //<link href="http://xyz.org/metadata" rel="describedby" type="application/xml"/>
- $feedLink = $feedDoc->createElement("link");
- if ($type == 'SERVICE') {
- $feedLink->setAttribute("href", "http://".$_SERVER['HTTP_HOST']."/mapbender/php/mod_dataLinkDownloadISOMetadata.php?Id=".$recordId."&outputFormat=iso19139");
- } else { //DATASET
- $feedLink->setAttribute("href", "http://".$_SERVER['HTTP_HOST']."/mapbender/php/mod_dataISOMetadata.php?id=".$mapbenderMetadata['metadata_uuid']."&outputFormat=iso19139");
- }
- $feedLink->setAttribute("rel", "describedby");
- $feedLink->setAttribute("rel", "application/xml");
- $feedLink->setAttribute("title", "Metadaten");
- $feedLink->setAttribute("hreflang", "de");
- $feed->appendChild($feedLink);
-
- //self reference - 5.1.4 / 5.2
- if ($type == 'SERVICE') {
- $selfReference = "http://".$_SERVER['HTTP_HOST']."/mapbender/php/mod_inspireWmsDownloadFeed.php?ID=".$recordId."&type=SERVICE";
- } else { //DATASET
- $selfReference = "http://".$_SERVER['HTTP_HOST']."/mapbender/php/mod_inspireWmsDownloadFeed.php?ID=".$recordId."&type=DATASET";
- }
-
- //<link href="http://xyz.org/data" rel="self" type="application/atom+xml" hreflang="en" title="This document"/>
- $feedLink = $feedDoc->createElement("link");
- $feedLink->setAttribute("href", $selfReference);
- $feedLink->setAttribute("rel", "self");
- $feedLink->setAttribute("type", "application/atom+xml");
- $feedLink->setAttribute("hreflang", "de");
- $feedLink->setAttribute("title", "Selbstreferenz");
- $feed->appendChild($feedLink);
-
- //opensearch descriptionlink 5.1.5
- if ($type == 'SERVICE') {
- $feedLink = $feedDoc->createElement("link");
- $feedLink->setAttribute("href", "http://".$_SERVER['HTTP_HOST']."/mapbender/php/mb_datalinkOpensearchDescription.php?ID=".$recordId);
- $feedLink->setAttribute("rel", "search");
- $feedLink->setAttribute("type", "application/opensearchdescription+xml");
- $feedLink->setAttribute("hreflang", "de");
- $feedLink->setAttribute("title", "Open Search Beschreibung des INSPIRE Download Dienstes für den Datensatz ".$ressourceTitle);
- $feed->appendChild($feedLink);
- } else { //5.2.2
-
- //description of datatypes - if given??? What todo when there is no description available - some html page have to be referenced?
- $feedLink = $feedDoc->createElement("link");
- $feedLink->setAttribute("href", "http://".$_SERVER['HTTP_HOST']."/mapbender/php/mod_showMetadata.php?languageCode=de&resource=layer&layout=tabs&id=".$recordId);
- $feedLink->setAttribute("rel", "describedby");
- $feedLink->setAttribute("type", "text/html");
- $feedLink->setAttribute("hreflang", "de");
- $feedLink->setAttribute("title", "Beschreibung des Datensatzes");
- $feed->appendChild($feedLink);
- }
- //5.1.6 - 5.1.7
- //other -- not needed cause only one language is defined
- //<link href="http://xyz.org/data/de" rel="alternate" type="application/atom+xml" hreflang="de" title="The download service information in German"/>
- //<link href="http://xyz.org/data/index.html" rel="alternate" type="text/html" hreflang="en" title="An HTML version of this document"/>
- //<link href="http://xyz.org/data/index.de.html" rel="alternate" type="text/html" hreflang="de" title="An HTML version of this document in German"/>
-
-
- //<!-- identifier -->
- //<id>http://xyz.org/data</id> - also self reference - see 5.1.8 on page 39 of INSPIRE GD for Download Services V 3.0
- // and 5.2.1
- $feedId = $feedDoc->createElement("id");
- $feedIdText = $feedDoc->createTextNode($ressourceId);
- $feedId->appendChild($feedIdText);
- $feed->appendChild($feedId);
-
- //<!-- rights, access restrictions -->
- //<rights>Copyright (c) 2011, XYZ; all rights reserved</rights> -- see 5.1.9 on page 39 of INSPIRE GD for Download Services V 3.0 - only accessconstraints should be used
- $feedRights = $feedDoc->createElement("rights");
- $feedRightsText = $feedDoc->createTextNode($mapbenderMetadata['accessconstraints']);
- $feedRights->appendChild($feedRightsText);
- $feed->appendChild($feedRights);
-
- //<!-- date/time of last update of feed--> -- see 5.1.10 on page 40 of INSPIRE GD for Download Services V 3.0 - maybe date of metadata should be used - first we use current date!
- //<updated>2011-09-24T13:45:03Z</updated>
- $feedUpdated = $feedDoc->createElement("updated");
- $feedUpdatedText = $feedDoc->createTextNode(date(DATE_ATOM,time()));
- $feedUpdated->appendChild($feedUpdatedText);
- $feed->appendChild($feedUpdated);
-
- //<!-- author info --> 5.1.11
- //<author>
- // <name>John Doe</name>
- // <email>doe at xyz.org</email>
- //</author>
- $feedAuthor = $feedDoc->createElement("author");
- $feedAuthorName = $feedDoc->createElement("name");
- $feedAuthorName->appendChild($feedDoc->createTextNode($departmentMetadata["mb_group_title"]));
- $feedAuthorEmail = $feedDoc->createElement("email");
- $feedAuthorEmail->appendChild($feedDoc->createTextNode($departmentMetadata["mb_group_email"]));
- $feedAuthor->appendChild($feedAuthorName);
- $feedAuthor->appendChild($feedAuthorEmail);
- $feed->appendChild($feedAuthor);
-
- //<!-- pre-defined dataset - a entry for each pre-defined dataset - in the case of dataURL only one entry is used! -->
- //if dataurl not given and a raster wms is defined - calculate the number of entries
- if ($generateFromDataurl != true && $type == 'DATASET') {
- //calculate number of entries and the bboxes
- if ($mapbenderMetadata['spatial_res_type'] != 'groundDistance' & $mapbenderMetadata['spatial_res_type'] != 'scaleDenominator') {
- echo "<error>WMS footprints cannot be calculated, cause kind of resolution is not given.</error>";
- } else {
- if (!is_int((integer)$mapbenderMetadata['spatial_res_value'])) {
- echo "<error>WMS footprints cannot be calculated, cause resolution is no integer.</error>";
- } else {
- //calculate the bboxes
- //transform layer_bbox to mb_metadata epsg
- /*$georssPolygon = $mapbenderMetadata["minx"]." ".$mapbenderMetadata["miny"]." ".$mapbenderMetadata["maxx"]." ".$mapbenderMetadata["miny"]." ";
- $georssPolygon .= $mapbenderMetadata["maxx"]." ".$mapbenderMetadata["maxy"]." ".$mapbenderMetadata["minx"]." ".$mapbenderMetadata["maxy"]." ";
- $georssPolygon .= $mapbenderMetadata["minx"]." ".$mapbenderMetadata["miny"];
- echo $georssPolygon;*/
- //TODO: check if epsg, and bbox are filled correctly!
-
- $sqlMinx = "SELECT X(transform(GeometryFromText('POINT(".$mapbenderMetadata["minx"]." ".$mapbenderMetadata["miny"].")',4326),".$epsgId[1].")) as minx";
- $resMinx = db_query($sqlMinx);
- $minx = floatval(db_result($resMinx,0,"minx"));
-
- $sqlMiny = "SELECT Y(transform(GeometryFromText('POINT(".$mapbenderMetadata["minx"]." ".$mapbenderMetadata["miny"].")',4326),".$epsgId[1].")) as miny";
- $resMiny = db_query($sqlMiny);
- $miny = floatval(db_result($resMiny,0,"miny"));
-
- $sqlMaxx = "SELECT X(transform(GeometryFromText('POINT(".$mapbenderMetadata["maxx"]." ".$mapbenderMetadata["maxy"].")',4326),".$epsgId[1].")) as maxx";
- $resMaxx = db_query($sqlMaxx);
- $maxx = floatval(db_result($resMaxx,0,"maxx"));
-
- $sqlMaxy = "SELECT Y(transform(GeometryFromText('POINT(".$mapbenderMetadata["maxx"]." ".$mapbenderMetadata["maxy"].")',4326),".$epsgId[1].")) as maxy";
- $resMaxy = db_query($sqlMaxy);
- $maxy = floatval(db_result($resMaxy,0,"maxy"));
-
-
- $diffX = $maxx - $minx; //in m
- $diffY = $maxy - $miny; //in m
- //echo $diffX .":". $diffY;
- //calculate target number of pixels for x and y
- switch ($mapbenderMetadata['spatial_res_type']) {
- case "scaleDenominator":
- //transform to pixel
- $diffXPx = $diffX / (float)$mapbenderMetadata['spatial_res_value'] / (float)0.0254 * floatval($imageResolution);
- $diffYPx = $diffY / (float)$mapbenderMetadata['spatial_res_value'] / (float)0.0254 * floatval($imageResolution);
- break;
- case "groundDistance":
- //transform to pixel
- $diffXPx = $diffX / floatval($mapbenderMetadata['spatial_res_value']);
- $diffYPx = $diffY / floatval($mapbenderMetadata['spatial_res_value']);
-
- break;
- }
- //echo $diffXPx.":".$diffYPx;
-
- $nRows = ceil($diffYPx / floatval($maxImageSize));
- $nCols = ceil($diffXPx / floatval($maxImageSize));
- //echo $nRows.":".$nCols;
- $bboxWms = array();
- /*echo $diffXPx.":".$diffYPx.",";
- echo $nRows.":".$nCols.",";
- echo $minx.":".$miny.",";
- echo $maxx.":".$maxy.",";*/
- $incX = $diffX / ($diffXPx / floatval($maxImageSize));
- $incY = $diffY / ($diffYPx / floatval($maxImageSize));
- for ($j = 0; $j < $nRows; $j++) {
- for ($k = 0; $k < $nCols; $k++) {
- //echo "j: ".$k.",k: ".$j;
- $minxWms = $minx + $k * $incX;
- //echo "minxWms: ". $minxWms .",";
- $minyWms = $miny + $j * $incY;
- //echo "minyWms: ". $minyWms .",";
- $maxxWms = $minx + ($k+1) * $incX;
- //echo "maxxWms: ". $maxxWms .",";
- $maxyWms = $miny + ($j+1) * $incY;
- //echo "maxyWms: ". $maxyWms .",";
- $bboxWms[] = $minxWms.",".$minyWms.",".$maxxWms.",".$maxyWms;
- }
- }
- }
- }
- $numberOfEntries = count($bboxWms);
- } else {
- $numberOfEntries = 1;
- }
-
- for ($i = 0; $i < $numberOfEntries; $i++) {
- //<entry> 5.1.12 / 5.2.3
-
- $feedEntry = $feedDoc->createElement("entry");
-
- //<!-- title for pre-defined dataset -->
- //<title xml:lang="en">Water network ABC</title>
- //<title>Water network in CRS EPSG:4258 (GML)</title>
- $feedEntryTitle = $feedDoc->createElement("title");
- //$feedEntryTitle->setAttribute("xml:lang", "de");
- if ($type == 'SERVICE') {
- $feedEntryTitle->appendChild($feedDoc->createTextNode("Feed Entry für: ".$ressourceTitle)); //TODO: maybe add some category?
- } else {
- $feedEntryTitle->appendChild($feedDoc->createTextNode($ressourceTitle. " im CRS ".$mapbenderMetadata['metadata_ref_system']." und Format ".$mapbenderMetadata['format'])); //TODO: maybe add some category?
- }
- $feedEntry->appendChild($feedEntryTitle);
-
- //<!-- link to a single dataset feed - see 5.1.13 on page 41 of INSPIRE GD for Download Services V 3.0 -->
- //<link rel="alternate" href="http://xyz.org/data/waternetwork_feed.xml" type="application/atom+xml" hreflang="en" title="Feed containing the pre-defined waternetwork dataset (in one or more downloadable formats)"/>
-
- //or link to dataset 5.2.3
-
- //<link rel="alternate" href="http://xyz.org/data/abc/waternetwork_WGS84.shp" type="application/x-shp" hreflang="en" title="Water Network encoded as a ShapeFile in WGS84geographic coordinates (http://www.opengis.net/def/crs/OGC/1.3/CRS84)"/>
-
- $datasetFeedLink = "http://".$_SERVER['HTTP_HOST']."/mapbender/php/mod_inspireWmsDownloadFeed.php?id=".$recordId."&type=DATASET";
- $datasetLink = $mapbenderMetadata['datalink_url'];
-
- if ($type == 'SERVICE') {
- $furtherLink = $datasetFeedLink;
- $furtherLinkType = "application/xml";
- $furtherLinkTitle = "Feed für den pre-defined Datensatz ".$ressourceTitle;
- } else {
- if ($generateFromDataurl == true) {
- $furtherLink = $datasetLink;
- $furtherLinkType = $mapbenderMetadata['datalink_format'];
- $furtherLinkTitle = $ressourceTitle." im CRS ".$mapbenderMetadata['metadata_ref_system']."(".$mapbenderMetadata['format'].")";
- } else {
- $furtherLink = $datasetLink; // dynamic generated links
- //example:
- //http://localhost/cgi-bin/mapserv?map=/data/umn/geoportal/karte_rp/testinspiredownload.map&VERSION=1.1.1&REQUEST=GetMap&SERVICE=WMS&LAYERS=inspirewms&STYLES=&SRS=EPSG:4326&BBOX=6.92134,50.130465,6.93241,50.141535000000005&WIDTH=200&HEIGHT=200&FORMAT=image/png&BGCOLOR=0xffffff&TRANSPARENT=TRUE&EXCEPTIONS=application/vnd.ogc.se_inimage
- $furtherLink = $mapbenderMetadata['wms_getmap']."REQUEST=GetMap&VERSION=".$mapbenderMetadata['wms_version']."&SERVICE=WMS&LAYERS=".$mapbenderMetadata['layer_name'];
- $furtherLink .= "&STYLES=&SRS=".$crs."&BBOX=".$bboxWms[$i]."&WIDTH=".$maxImageSize."&HEIGHT=".$maxImageSize."&FORMAT=image/tiff&";
- $furtherLink .= "BGCOLOR=0xffffff&TRANSPARENT=TRUE&EXCEPTIONS=application/vnd.ogc.se_inimage";
- $furtherLinkType = $mapbenderMetadata['datalink_format']; //formats from layer_format - geotiff
- $furtherLinkTitle = $ressourceTitle." im CRS ".$mapbenderMetadata['metadata_ref_system']."(".$mapbenderMetadata['format'].")";
- }
- }
- //In the case of dynamically build entries for a raster based wms - not the dataurl but another the dyn ulrs will be used in the next feed
-
- $feedEntryLink = $feedDoc->createElement("link");
- $feedEntryLink->setAttribute("rel", "alternate");
- $feedEntryLink->setAttribute("href", $furtherLink);
- $feedEntryLink->setAttribute("type", $furtherLinkType);
- $feedEntryLink->setAttribute("hreflang", "de");
- $feedEntryLink->setAttribute("title", $furtherLinkTitle);
- $feedEntry->appendChild($feedEntryLink);
-
- //5.1.14 / 5.2
- //<!-- identifier for pre-defined dataset -->
- //<id>http://xyz.org/data/waternetwork.gml/id>
- $feedEntryId = $feedDoc->createElement("id");
- $feedEntryId->appendChild($feedDoc->createTextNode($ressourceId."_tile_".$i));
- $feedEntry->appendChild($feedEntryId);
-
- //5.1.15 /
- //<!-- summary -->
- //<summary>This is the entry for water network ABC Dataset</summary>
- if ($type == 'SERVICE') {
- $feedEntrySummary = $feedDoc->createElement("summary");
- $feedEntrySummary->appendChild($feedDoc->createTextNode("Nähere Beschreibung des Feedinhaltes: ".$ressourceAbstract));
- $feedEntry->appendChild($feedEntrySummary);
- }
- //5.1.14 / 5.2 - updated
- //<!-- last date/time pre-defined dataset was updated -->
- //<updated>2011-06-14T12:22:09Z</updated>
- $feedEntryUpdated = $feedDoc->createElement("updated");
- $feedEntryUpdated->appendChild($feedDoc->createTextNode(date(DATE_ATOM,time())));
- $feedEntry->appendChild($feedEntryUpdated);
-
- //5.1.16 / 5.2?
- //<!-- optional GeoRSS-Simple bounding box of the pre-defined dataset. Must be lat lon -->
- //<georss:polygon>47.202 5.755 55.183 5.755 55.183 15.253 47.202 15.253 47.202 5.755</georss:polygon>
- //TODO: Get this out of mb_metadata! If not given get it from layer bbox - but normally they should be identical!
- $feedEntryBbox = $feedDoc->createElement("georss:polygon");
- if ($generateFromDataurl == true) {
- $georssPolygon = $mapbenderMetadata["minx"]." ".$mapbenderMetadata["miny"]." ".$mapbenderMetadata["maxx"]." ".$mapbenderMetadata["miny"]." ";
- $georssPolygon .= $mapbenderMetadata["maxx"]." ".$mapbenderMetadata["maxy"]." ".$mapbenderMetadata["minx"]." ".$mapbenderMetadata["maxy"]." ";
- $georssPolygon .= $mapbenderMetadata["minx"]." ".$mapbenderMetadata["miny"];
- } else {
- //dynamically generated bboxes - for the raster wms
- //$georssPolygon = $mapbenderMetadata["minx"]." ".$mapbenderMetadata["miny"]." ".$mapbenderMetadata["maxx"]." ".$mapbenderMetadata["miny"]." ";
- //$georssPolygon .= $mapbenderMetadata["maxx"]." ".$mapbenderMetadata["maxy"]." ".$mapbenderMetadata["minx"]." ".$mapbenderMetadata["maxy"]." ";
- //$georssPolygon .= $mapbenderMetadata["minx"]." ".$mapbenderMetadata["miny"];
- //TODO: Transform them to epsg:4326 to be conform to georss polygon
- $corners = $bboxWms[$i];
- $corners = explode(",",$corners);
- $georssPolygon = $corners[1]." ".$corners[0]." ".$corners[3]." ".$corners[0]." ";
- $georssPolygon .= $corners[3]." ".$corners[2]." ".$corners[1]." ".$corners[2]." ";
- $georssPolygon .= $corners[1]." ".$corners[0];
- }
- $feedEntryBbox->appendChild($feedDoc->createTextNode($georssPolygon));
- $feedEntry->appendChild($feedEntryBbox);
-
- //category entry for crs (from mb_metadata) 5.1.17
- /*<!-- CRSs in which the pre-defined Dataset is available --> <category term="EPSG:25832" scheme="http://www.opengis.net/def/crs/" label="EPSG/0/25832"/> <category term="EPSG:4258" scheme="http://www.opengis.net/def/crs/" label="EPSG/0/4258"/>*/
-
- $feedEntryCategory = $feedDoc->createElement("category");
- $feedEntryCategory->setAttribute("term", $epsgId[1]);
- $feedEntryCategory->setAttribute("scheme", "http://www.opengis.net/def/crs/");
- $feedEntryCategory->setAttribute("label", "EPSG/0/".$epsgId[1]);
- $feedEntry->appendChild($feedEntryCategory);
-
- //<!-- INSPIRE Spatial Object Types contained in the pre-defined dataset -->
- //<category term="Watercourse" scheme="http://inspire-registry.jrc.ec.europa.eu/registers/FCD/" label="Watercourse" xml:lang="en"/>
- //only applicable for inspire conformant datasets!
- //Generate List of inspire themes of the given layer!
- /*$sql = "SELECT inspire_category.inspire_category_id, inspire_category.inspire_category_code_en FROM inspire_category, layer_inspire_category WHERE layer_inspire_category.fkey_layer_id=$1 AND layer_inspire_category.fkey_inspire_category_id=inspire_category.inspire_category_id";
- $v = array((integer)$mapbenderMetadata['layer_id']);
- $t = array('i');
- $res = db_prep_query($sql,$v,$t);
- while ($row = db_fetch_array($res)) {
- //part for the name of the inspire category
- $feedEntryCategory = $feedDoc->createElement("category");
- $feedEntryCategory->setAttribute("term", $row['inspire_category_code_en']);
- $feedEntryCategory->setAttribute("scheme", "http://www.eionet.europa.eu/gemet/theme_concepts?langcode=en&ns=5&th=".$row['inspire_category_id']);
- $feedEntryCategory->setAttribute("label", $row['inspire_category_code_en']);
- $feedEntryCategory->setAttribute("xml:lang", "en");
- $feedEntry->appendChild($feedEntryCategory);
- }
- */
- /*$feedEntryCategory = $feedDoc->createElement("category");
- $feedEntryCategory->setAttribute("term", "Watercourse");
- $feedEntryCategory->setAttribute("scheme", "http://inspire-registry.jrc.ec.europa.eu/registers/FCD/");
- $feedEntryCategory->setAttribute("label", "Watercourse");
- $feedEntryCategory->setAttribute("xml:lang", "en");
- $feedEntry->appendChild($feedEntryCategory);
- //<category term="StandingWater" scheme="http://inspire-registry.jrc.ec.europa.eu/registers/FCD/" label="Standing Water" xml:lang="en"/>
- $feedEntryCategory = $feedDoc->createElement("category");
- $feedEntryCategory->setAttribute("term", "StandingWater");
- $feedEntryCategory->setAttribute("scheme", "http://inspire-registry.jrc.ec.europa.eu/registers/FCD/");
- $feedEntryCategory->setAttribute("label", "Standing Water");
- $feedEntryCategory->setAttribute("xml:lang", "en");
- $feedEntry->appendChild($feedEntryCategory);*/
- //</entry>
-
- $feed->appendChild($feedEntry);
- }
- return $feedDoc->saveXML();
-}
-
-//function to give away the xml data
-function pushFeed($feedDoc, $recordId) {
- header("Content-type: application/xhtml+xml; charset=UTF-8");
- $xml = generateFeed($feedDoc, $recordId);
- echo $xml;
- die();
-}
-
-//do all the other things which had to be done ;-)
-pushFeed($feedDoc, $recordId); //throw it out to world!
-
-?>
-
Modified: trunk/mapbender/http/php/mod_showMetadata.php
===================================================================
--- trunk/mapbender/http/php/mod_showMetadata.php 2012-06-18 20:48:30 UTC (rev 8385)
+++ trunk/mapbender/http/php/mod_showMetadata.php 2012-06-19 15:12:44 UTC (rev 8386)
@@ -1062,6 +1062,23 @@
$i = 0;
$metadataList = "";
while ($row = db_fetch_assoc($res)) {
+ //check for existing download options
+ $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;
+ /*$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"]);
+ $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']);
+
//$html .= "<li>";
switch ($row["origin"]) {
case "capabilities" :
@@ -1079,7 +1096,11 @@
default:
break;
}
- $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><br>";
+ $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>";
+ }
+ $metadataList .= "<br>";
$i++;
}
if ($i != 0) {
More information about the Mapbender_commits
mailing list