[Mapbender-commits] r8350 - trunk/mapbender/http/php

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Mon May 14 02:03:51 EDT 2012


Author: armin11
Date: 2012-05-13 23:03:50 -0700 (Sun, 13 May 2012)
New Revision: 8350

Removed:
   trunk/mapbender/http/php/mod_dataLinkInspireFeed.php
Modified:
   trunk/mapbender/http/php/mod_inspireWmsDownloadFeed.php
Log:
Delete file which is not needed any more

Deleted: trunk/mapbender/http/php/mod_dataLinkInspireFeed.php
===================================================================
--- trunk/mapbender/http/php/mod_dataLinkInspireFeed.php	2012-05-11 07:43:18 UTC (rev 8349)
+++ trunk/mapbender/http/php/mod_dataLinkInspireFeed.php	2012-05-14 06:03:50 UTC (rev 8350)
@@ -1,354 +0,0 @@
-<?php
-//http://www.geoportal.rlp.de/mapbender/php/mod_dataLinkInspireFeed.php?Id=20578&VERSION=1.0
-//http://localhost/mapbender/php/mod_dataLinkInspireFeed.php?Id=20578&VERSION=1.0
-// $Id: mod_dataLinkInspireFeed.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 2.6 from 02/2012. It will be generated from given wms layers dataurl attributs which are registrated in the mapbender database. It works as a webservice
-
-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();
-
-//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 ($_REQUEST['VERSION'] == "1.0") {
-	//Initialize XML document
-	$feedDoc = new DOMDocument('1.0');
-	$feedDoc->encoding = 'UTF-8';
-} else {
-	echo 'VERSION: <b>'.$_REQUEST['VERSION'].'</b> is not set or valid.<br/>'; 
-	die();
-}
-
-//some needfull functions to pull metadata out of the database!
-function generateFeed($feedDoc, $recordId) {
-	global $admin;
-	$sql = <<<SQL
-
-select * from (select * from (select * from (select * from (select * 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;
-
-	$v = array((integer)$recordId);
-	$t = array('i');
-	$res = db_prep_query($sql,$v,$t);
-	$mapbenderMetadata = db_fetch_array($res);
-	
-	//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_dataLinkDownloadISOMetadata.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_dataLinkDownloadISOMetadata.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);
-
-	//check if resource is freely available to anonymous user - which are all users who search thru metadata catalogues:
-	$hasPermission=$admin->getLayerPermission($mapbenderMetadata['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");
-	
-	//qualifying
-	if (isset($mapbenderMetadata["datasetid"]) && $mapbenderMetadata["datasetid"] != '' ) {
-		$ressourceId = $mapbenderMetadata["datasetid"];
-	} else {
-		if (isset($mapbenderMetadata["uuid"]) && $mapbenderMetadata["uuid"] != '' ) {
-			$ressourceId = $mapbenderMetadata["uuid"];
-		} else {
-			$ressourceId = "ID of dataset cannot be found!";
-		}
-	}
-	//first use metadata title then layer title
-	if (isset($mapbenderMetadata["title"]) && $mapbenderMetadata["title"] != '' ) {
-		$ressourceTitle = $mapbenderMetadata["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["abstract"]) && $mapbenderMetadata["abstract"] != '' ) {
-		$ressourceAbstract = $mapbenderMetadata["abstract"];
-	} else {
-		if (isset($mapbenderMetadata["layer_abstract"]) && $mapbenderMetadata["layer_abstract"] != '' ) {
-			$ressourceAbstract = $mapbenderMetadata["layer_abstract"];
-		} else {
-			$ressourceAbstract = "Abstract of dataset cannot be found!";
-		}
-	}
-
-
-	//feed metadata
-
-	//<title xml:lang="en">XYZ INSPIRE Download Service</title>
-	$feedTitle = $feedDoc->createElement("title");
-	$feedTitle->setAttribute("xml:lang", "de");
-	$feedTitleText = $feedDoc->createTextNode("INSPIRE Download Service: ".$ressourceTitle);
-
-	$feedTitle->appendChild($feedTitleText);
-	$feed->appendChild($feedTitle);
-
-	//<subtitle xml:lang="en">INSPIRE Download Service of organisation XYZ providing a data set for the Hydrography theme</subtitle>
-	$feedSubTitle = $feedDoc->createElement("subtitle");
-	$feedSubTitle->setAttribute("xml:lang", "de");
-	$feedSubTitleText = $feedDoc->createTextNode($ressourceAbstract);
-	
-	$feedSubTitle->appendChild($feedSubTitleText);
-	$feed->appendChild($feedSubTitle);
-
-	//links
-	//metadata
-	//<link href="http://xyz.org/metadata" rel="describedby" type="application/xml"/>
-	$feedLink = $feedDoc->createElement("link");
-	$feedLink->setAttribute("href", "http://".$_SERVER['HTTP_HOST']."/mapbender/php/mod_dataLinkDownloadISOMetadata.php?Id=".$recordId."&outputFormat=iso19139");
-	$feedLink->setAttribute("rel", "describedby");
-	$feedLink->setAttribute("rel", "application/xml");
-
-	$feed->appendChild($feedLink);
-
-	//self
-	//<link href="http://xyz.org/data" rel="self" type="application/atom+xml" hreflang="en" title="This document"/>
-	$feedLink = $feedDoc->createElement("link");
-	$feedLink->setAttribute("href", "http://".$_SERVER['HTTP_HOST']."/mapbender/php/mod_dataLinkInspireFeed.php?Id=".$recordId."&VERSION=1.0");
-	$feedLink->setAttribute("rel", "self");
-	$feedLink->setAttribute("rel", "application/atom+xml");
-	$feedLink->setAttribute("hreflang", "de");
-	$feedLink->setAttribute("title", "Selbstreferenz");
-
-	$feed->appendChild($feedLink);
-	//other
-	//<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>
-	$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>
-	$feedRights = $feedDoc->createElement("rights");
-	$feedRightsText = $feedDoc->createTextNode($mapbenderMetadata['accessconstraints'].htmlentities("<br>").$mapbenderMetadata['fees']);
-	$feedRights->appendChild($feedRightsText);
-	$feed->appendChild($feedRights);
-	//<!-- date/time of last update of feed-->
-	//<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 -->
-	//<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 -->
-	//<entry>
-	$feedEntry = $feedDoc->createElement("entry");
-	
-	//<!-- title for pre-defined dataset -->
-	//<title xml:lang="en">Water network ABC</title>
-	$feedEntryTitle = $feedDoc->createElement("title");
-	$feedEntryTitle->setAttribute("xml:lang", "de");
-	
-	$feedEntryTitle->appendChild($feedDoc->createTextNode($ressourceTitle));
-	$feedEntry->appendChild($feedEntryTitle);
-	
-	//<!-- download link for pre-defined dataset -->
-	//<link rel="enclosure" href="http://xyz.org/data/waternetwork.gml" type="application/gml+xml;version=3.2" hreflang="en" title="The data set encoded as a GML 3.2 document in ETRS89 UTM zone 32N (http://www.opengis.net/def/crs/EPSG/0/25832)"/>
-	$feedEntryLink = $feedDoc->createElement("link");
-	$feedEntryLink->setAttribute("rel", "enclosure");
-
-	$feedEntryLink->setAttribute("href", $mapbenderMetadata["datalink_url"]);
-
-	$feedEntryLink->setAttribute("type", $mapbenderMetadata["datalink_format"]);
-	$feedEntryLink->setAttribute("hreflang", "de");
-	$feedEntryLink->setAttribute("title", $feedEntryTitleText);
-	$feedEntry->appendChild($feedEntryLink);
-	//<!-- identifier for pre-defined dataset -->
-	//<id>http://xyz.org/data/waternetwork.gml/id>
-
-
-
-
-	$feedEntryId = $feedDoc->createElement("id");
-	$feedEntryId->appendChild($feedDoc->createTextNode($ressourceId));
-	$feedEntry->appendChild($feedEntryId);
-	//<!-- rights, access info for pre-defined dataset -->
-	//<rights>Copyright (c) 2002-2011, XYZ; all rights reserved</rights>
-	$feedEntryRights = $feedDoc->createElement("rights");
-	$feedEntryRights->appendChild($feedDoc->createTextNode($mapbenderMetadata['accessconstraints'].htmlentities("<br>").$mapbenderMetadata['fees']));
-	$feedEntry->appendChild($feedEntryRights);
-	//<!-- last date/time pre-defined dataset was updated -->
-	//<updated>2011-06-14T12:22:09Z</updated>
-	$feedEntryUpdated = $feedDoc->createElement("updated");
-	$feedEntryUpdated->appendChild($feedDoc->createTextNode($mapbenderMetadata["datalink_timestamp"]));
-	$feedEntry->appendChild($feedEntryUpdated);
-	//<!-- optional GeoRSS-Simple bounding box of the pre-defined dataset. Must be lat lon -->
-	//<georss:box>47.202 5.755 55.183 15.253</georss:box>
-	$feedEntryBbox = $feedDoc->createElement("georss:box");
-	$feedEntryBbox->appendChild($feedDoc->createTextNode($mapbenderMetadata["minx"]." ".$mapbenderMetadata["miny"]." ".$mapbenderMetadata["maxx"]." ".$mapbenderMetadata["maxy"]));
-	$feedEntry->appendChild($feedEntryBbox);
-	//<!-- 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();
-}
-
-function getEpsgByLayerId ($layer_id) { // from merge_layer.php
-	$epsg_list = "";
-	$sql = "SELECT DISTINCT epsg FROM layer_epsg WHERE fkey_layer_id = $1";
-	$v = array($layer_id);
-	$t = array('i');
-	$res = db_prep_query($sql, $v, $t);
-	while($row = db_fetch_array($res)){
-		$epsg_list .= $row['epsg'] . " ";
-	}
-	return trim($epsg_list);
-}
-
-function getEpsgArrayByLayerId ($layer_id) { // from merge_layer.php
-	//$epsg_list = "";
-	$epsg_array=array();
-	$sql = "SELECT DISTINCT epsg FROM layer_epsg WHERE fkey_layer_id = $1";
-	$v = array($layer_id);
-	$t = array('i');
-	$res = db_prep_query($sql, $v, $t);
-	$cnt=0;
-	while($row = db_fetch_array($res)){
-		$epsg_array[$cnt] = $row['epsg'];
-		$cnt++;
-	}
-	return $epsg_array;
-}
-
-
-
-//do all the other things which had to be done ;-)
-pushFeed($feedDoc, $recordId); //throw it out to world!
-
-?>
-

Modified: trunk/mapbender/http/php/mod_inspireWmsDownloadFeed.php
===================================================================
--- trunk/mapbender/http/php/mod_inspireWmsDownloadFeed.php	2012-05-11 07:43:18 UTC (rev 8349)
+++ trunk/mapbender/http/php/mod_inspireWmsDownloadFeed.php	2012-05-14 06:03:50 UTC (rev 8350)
@@ -35,7 +35,7 @@
 
 $imageResolution = 150;
 
-$maxImageSize = 1000;
+$maxImageSize = 100;
 
 //pull the needed things from tables datalink, md_metadata, layer, wms
  



More information about the Mapbender_commits mailing list