[Mapbender-commits] r8483 - in trunk/mapbender/http: classes javascripts plugins

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Tue Sep 4 08:31:41 PDT 2012


Author: armin11
Date: 2012-09-04 08:31:40 -0700 (Tue, 04 Sep 2012)
New Revision: 8483

Modified:
   trunk/mapbender/http/classes/class_connector.php
   trunk/mapbender/http/javascripts/mb_downloadFeedClient.js
   trunk/mapbender/http/plugins/mb_downloadFeedServer.php
Log:
Bugfixes, INSPIRE Download feed client works now with feeds from austria and netherlands

Modified: trunk/mapbender/http/classes/class_connector.php
===================================================================
--- trunk/mapbender/http/classes/class_connector.php	2012-09-04 09:23:02 UTC (rev 8482)
+++ trunk/mapbender/http/classes/class_connector.php	2012-09-04 15:31:40 UTC (rev 8483)
@@ -193,6 +193,8 @@
 	}
 	
 	private function getCURL($url){
+		//urls should begin with http ;-)
+		$url=ltrim($url);
 		$url=Str_replace(" ","+",$url); //to have no problems with image/png; mode=24bit!
 		$url=str_replace(";","%3B",$url);
 		if (func_num_args() == 2) {
@@ -294,7 +296,7 @@
 		curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
 		}
 		#curl_setopt($ch, CURLOPT_HEADER, true);
-		$e = new mb_notice("class_connector.php: CURL connect to: ".$url); 
+		$e = new mb_notice("class_connector.php: CURL connect to:".$url); 
 		//curl_setopt ($ch,CURLOPT_USERAGENT,$useragent);
 		curl_setopt($ch,CURLOPT_DNS_USE_GLOBAL_CACHE, false);
 		curl_setopt($ch,CURLINFO_HEADER_OUT, true);

Modified: trunk/mapbender/http/javascripts/mb_downloadFeedClient.js
===================================================================
--- trunk/mapbender/http/javascripts/mb_downloadFeedClient.js	2012-09-04 09:23:02 UTC (rev 8482)
+++ trunk/mapbender/http/javascripts/mb_downloadFeedClient.js	2012-09-04 15:31:40 UTC (rev 8483)
@@ -51,19 +51,25 @@
 	//generate 2 Mapframes
 	mapframe_dataset_list = new OpenLayers.Map('mapframe_dataset_list');
 	mapframe_file_list = new OpenLayers.Map('mapframe_file_list');
-	var wms1 = new OpenLayers.Layer.WMS( "OpenLayers WMS",
-                "http://www.gdi-rp-dienste2.rlp.de/cgi-bin/mapserv.fcgi?map=/data/umn/geoportal/karte_rp/rheinland-pfalz-gesamt2.map&", {layers: 'ATKIS-Praes'}, {singleTile: true});
+	var wms1 = new OpenLayers.Layer.WMS( "Open Layers WMS",
+                "http://www.gdi-rp-dienste2.rlp.de/cgi-bin/mapserv.fcgi?map=/data/umn/geoportal/karte_rp/rheinland-pfalz-gesamt2.map&", {layers: 'ATKIS-Praes',transparent: "true",format: "image/png"}, {singleTile: true, isBaseLayer: false});
+	var wms11 = new OpenLayers.Layer.WMS( "OpenLayers WMS",
+                "http://www2.demis.nl/wms/wms.ashx?wms=WorldMap&", {layers: 'Bathymetry,Countries,Topography,Hillshading,Coastlines,Waterbodies,Rivers,Streams,Railroads,Highways,Roads,Borders,Cities,Settlements,Airports'}, {singleTile: true});
 	//var wms_osm = new OpenLayers.Layer.WMS( "OpenLayers WMS",
         //        "http://osm.omniscale.net/proxy/service?", {layers: 'osm'}, {singleTile: true});
+	//var wms_osm = new OpenLayers.Layer.WMS( "OpenLayers WMS",
+        //        "http://osm.omniscale.net/proxy/service?", {layers: 'osm'}, {singleTile: true});
 	var wms2 = new OpenLayers.Layer.WMS( "OpenLayers WMS",
-                "http://www.gdi-rp-dienste2.rlp.de/cgi-bin/mapserv.fcgi?map=/data/umn/geoportal/karte_rp/rheinland-pfalz-gesamt2.map&", {layers: 'ATKIS-Praes'}, {singleTile: true});
+                "http://www.gdi-rp-dienste2.rlp.de/cgi-bin/mapserv.fcgi?map=/data/umn/geoportal/karte_rp/rheinland-pfalz-gesamt2.map&", {layers: 'ATKIS-Praes',transparent: "true",format: "image/png"}, {singleTile: true, isBaseLayer: false});
+	var wms22 = new OpenLayers.Layer.WMS( "DEMIS World",
+                "http://www2.demis.nl/wms/wms.ashx?wms=WorldMap&", {layers: 'Bathymetry,Countries,Topography,Hillshading,Coastlines,Waterbodies,Rivers,Streams,Railroads,Highways,Roads,Borders,Cities,Settlements,Airports'}, {singleTile: true});
 	//Vector layer for the georss polygons of the service feed - maybe more than one 
 	bboxDataset = new OpenLayers.Layer.Vector("Dataset bounding boxes");
 	//Vector layer for the georss polygons of one single data feed entry - maybe more than one if the dataset is tiled into different sections 
 	bboxFiles = new OpenLayers.Layer.Vector("File bounding boxes");
-	mapframe_dataset_list.addLayers([wms1, bboxDataset]);
+	mapframe_dataset_list.addLayers([wms11,wms1,bboxDataset]);
 	mapframe_dataset_list.addControl(new OpenLayers.Control.MousePosition());
-	mapframe_file_list.addLayers([wms2, bboxFiles]);
+	mapframe_file_list.addLayers([wms22,wms2,bboxFiles]);
 	mapframe_file_list.addControl(new OpenLayers.Control.MousePosition());
 	updateFormats();
 	//initialize mapframes
@@ -129,9 +135,9 @@
 	$("#client").css("height","450px");
 }
 
-
-function showDatasetList(featureCollection) {
+function showDatasetList(featureCollection,id) {
 	resetForm();
+	if (id === undefined) id = 0;
 	if (featureCollection == null) {
 		alert("No parseable content found");
 		return false;
@@ -144,11 +150,11 @@
 	var datasetSelect =  $(document.createElement('select')).appendTo('#dataset_list');
 	datasetSelect.attr({'id':'dataset_select'});
 	var selectOptions = "";
-	//iterate over all single features which con be identified with the entries of the inspire service feed 
+	//iterate over all single features which can be identified with the entries of the inspire service feed 
 	for(var i=0; i<featureCollection.features.length; ++i) {
 		//fill in first title, rights and abstract in fields
 //alert(featureCollection.features[i].properties.title);//$('#dataset_title').value = "";
-		if (i == 0) {
+		if (i == id) {
 			$('#dataset_title').val(featureCollection.features[i].properties.title);
 			$('#dataset_rights').val(featureCollection.features[i].properties.rights);
 			$('#dataset_abstract').val(featureCollection.features[i].properties.summary);
@@ -158,11 +164,13 @@
 			identifierAnchor.attr({'href':featureCollection.features[i].properties.metadataLink});
 			identifierAnchor.text(featureCollection.features[i].properties.namespace+"#"+featureCollection.features[i].properties.code);
 		}
-		selectOptions = selectOptions+"<option value='"+featureCollection.features[i].properties.datasetFeedLink+"' url='"+featureCollection.features[i].properties.datasetFeedLink+"'>"+featureCollection.features[i].properties.title+"</option>";
+		selectOptions = selectOptions+"<option value='"+featureCollection.features[i].properties.datasetFeedLink+"' url='"+featureCollection.features[i].properties.datasetFeedLink+"' optionid='"+i+"'>"+featureCollection.features[i].properties.title+"</option>";
 	}
 	datasetSelect.append(selectOptions);
 	$('#dataset_select').bind('change', function() {
-    		var $this = $(this);
+		var $this = $(this);
+		optionSelected = $(this).find('option:selected').attr('optionid')	
+		showDatasetList(featureCollection,optionSelected);
 		method =  "getDatasetFeedObjectFromUrl";
         	data = $this.val();
 		resetForm();
@@ -171,9 +179,7 @@
 	method =  "getDatasetFeedObjectFromUrl";
 	//call second feed with first entry for default
         data = featureCollection.features[0].properties.datasetFeedLink;
-	datasetFeedObject = callServer(data,method);
-	//alert("ajax call started");
-	
+	datasetFeedObject = callServer(data,method);	
 }
 
 function showDatasetEntryList(featureCollection, id) {

Modified: trunk/mapbender/http/plugins/mb_downloadFeedServer.php
===================================================================
--- trunk/mapbender/http/plugins/mb_downloadFeedServer.php	2012-09-04 09:23:02 UTC (rev 8482)
+++ trunk/mapbender/http/plugins/mb_downloadFeedServer.php	2012-09-04 15:31:40 UTC (rev 8483)
@@ -48,10 +48,24 @@
 	}
 }
 
+//for debugging purposes only
+function logit($text){
+	 if($h = fopen(LOG_DIR."/inspire_download_feed.log","a")){
+				$content = $text .chr(13).chr(10);
+				if(!fwrite($h,$content)){
+					#exit;
+				}
+				fclose($h);
+			}	 	
+}
 
 switch ($_REQUEST['method']) {
 	case "getServiceFeedObjectFromUrl" :
 		$serviceFeedUrl = $_REQUEST['url'];
+		$logUrl = date("F j, Y, g:i a",time())." - ".$serviceFeedUrl;
+		$e = new mb_exception("inspire: ".$logUrl);
+		logit($logUrl);
+			
 		//test url
 		//get feed from remote server
 		$feedConnector = new connector($serviceFeedUrl);



More information about the Mapbender_commits mailing list