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

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Wed Aug 7 02:55:21 PDT 2019


Author: armin11
Date: 2019-08-07 02:55:21 -0700 (Wed, 07 Aug 2019)
New Revision: 10198

Modified:
   trunk/mapbender/http/php/mod_linkedDataProxy.php
Log:
Some more limit options for wfs 3.0 proxy

Modified: trunk/mapbender/http/php/mod_linkedDataProxy.php
===================================================================
--- trunk/mapbender/http/php/mod_linkedDataProxy.php	2019-08-06 14:36:27 UTC (rev 10197)
+++ trunk/mapbender/http/php/mod_linkedDataProxy.php	2019-08-07 09:55:21 UTC (rev 10198)
@@ -12,7 +12,7 @@
 //default page
 $page = 0;
 //default format f
-$f = "json";
+$f = "html";
 //parameter to control if the native json should be requested from the server, if support for geojson is available!
 $nativeJson = false;
 //default outputFormat for wfs objects:
@@ -224,9 +224,9 @@
 if (!isset($wfsid) || $wfsid == "") {
     //list all public available wfs which are classified as opendata!
     $returnObject->service = array();
-    $sql = "SELECT * FROM (SELECT wfs_id, wfs_version, wfs_abstract, wfs_title, wfs_owsproxy, fkey_termsofuse_id, wfs_getcapabilities, providername, fees FROM wfs INNER JOIN wfs_termsofuse ON wfs_id = fkey_wfs_id) AS wfs_tou INNER JOIN termsofuse ON fkey_termsofuse_id = termsofuse_id WHERE isopen = 1";
+    //$sql = "SELECT * FROM (SELECT wfs_id, wfs_version, wfs_abstract, wfs_title, wfs_owsproxy, fkey_termsofuse_id, wfs_getcapabilities, providername, fees FROM wfs INNER JOIN wfs_termsofuse ON wfs_id = fkey_wfs_id) AS wfs_tou INNER JOIN termsofuse ON fkey_termsofuse_id = termsofuse_id WHERE isopen = 1";
     //all wfs - without open filter!
-    //$sql = "SELECT wfs_id, wfs_abstract, wfs_version, wfs_title, wfs_owsproxy, wfs_getcapabilities, providername, fees FROM wfs";
+    $sql = "SELECT wfs_id, wfs_abstract, wfs_version, wfs_title, wfs_owsproxy, wfs_getcapabilities, providername, fees FROM wfs";
     $v = array();
     $t = array();
     $res = db_prep_query($sql, $v, $t);	
@@ -349,9 +349,9 @@
 		} 
 	    }
 	    if ($ftNameInWfs) {
+		$myFeatureType = $wfs->findFeatureTypeByName($ftName);			
+		$geomColumnName = $wfs->findGeomColumnNameByFeaturetypeId($myFeatureType->id);
 	        if (!isset($item) || $item == "") {
-		    $myFeatureType = $wfs->findFeatureTypeByName($ftName);			
-		    $geomColumnName = $wfs->findGeomColumnNameByFeaturetypeId($myFeatureType->id);
 		    //generate description of collection in json
 		    $returnObject->name = $myFeatureType->name;
 		    $returnObject->title = $myFeatureType->title;
@@ -519,28 +519,28 @@
 					    }
 					}
 					break;
-				} 
+				    } 
 //$e = new mb_exception("bbox feature: minxF:".$minxF." minyF:".$minyF." maxxF:".$maxxF." maxyF:".$maxyF."");
-				if ($minxFC > $minxF) {
-				    $minxFC = $minxF;
-				}
-				if ($minyFC > $minyF) {
-				    $minyFC = $minyF;
-				}
-				if ($maxxFC < $maxxF) {
-				   $maxxFC = $maxxF;
-				}
-				if ($maxyFC < $maxyF){
-				    $maxyFC = $maxyF;
-				}
-				$geojsonBbox[$geojsonIndex]->minx = $minxF;
-				$geojsonBbox[$geojsonIndex]->miny = $minyF;
-				$geojsonBbox[$geojsonIndex]->maxx = $maxxF;
-				$geojsonBbox[$geojsonIndex]->maxy = $maxyF;
-				$geomType = $feature->geometry->type;
-			        $geojsonIndex++;
+				    if ($minxFC > $minxF) {
+				        $minxFC = $minxF;
+				    }
+				    if ($minyFC > $minyF) {
+				        $minyFC = $minyF;
+				    }
+				    if ($maxxFC < $maxxF) {
+				       $maxxFC = $maxxF;
+				    }
+				    if ($maxyFC < $maxyF){
+				        $maxyFC = $maxyF;
+				    }
+				    $geojsonBbox[$geojsonIndex]->minx = $minxF;
+				    $geojsonBbox[$geojsonIndex]->miny = $minyF;
+				    $geojsonBbox[$geojsonIndex]->maxx = $maxxF;
+				    $geojsonBbox[$geojsonIndex]->maxy = $maxyF;
+				    $geomType = $feature->geometry->type;
+			            $geojsonIndex++;
 //$e = new mb_exception("bbox featurecollection: minxFC:".$minxFC." minyFC:".$minyFC." maxxFC:".$maxxFC." maxyFC:".$maxyFC."");
-			    }
+			        }
 			    /*header('application/json');
 			    echo $features;
 			    die();*/
@@ -568,7 +568,7 @@
 				$geoJsonVariable = '<script>'.$newline;
 			    }
 			    foreach($gml3Object->featureCollection->featureArray as $mbFeature) {
-	//$e = new mb_exception("geojson from mb feature exporthandler: ".$mbFeature->toGeoJSON());
+//$e = new mb_exception("geojson from mb feature exporthandler: ".$mbFeature->toGeoJSON());
 			        //bbox
 			        $geojsonBbox[$geojsonIndex]->mbBbox = $mbFeature->getBbox();
 			        //transform to simple bbox object for leaflet
@@ -611,12 +611,191 @@
 			$returnObject->timeStamp = date('Y-m-d\TH:i:s.Z\Z', $date->getTimestamp());
 			$returnObject->genTime = $usedProxyTime;
 			$returnObject->features = $geojsonList->features;
-		    }
-		} else {	            
+		    } 
+//$e = new mb_exception("wfsid: ".$wfsid." - collection: ".$collection." - item: ".$item);
+		} else {
+//$e = new mb_exception("wfsid: ".$wfsid." - collection: ".$collection." - item: ".$item);	            
 		    //************************************************************************************************************************************
 	            //item part 
 	            //************************************************************************************************************************************
-		}	
+//$e = new mb_exception("wfsid: ".$wfsid." - collection: ".$collection." - item: ".$item);
+
+		   if (in_array('application/json; subtype=geojson', explode(',', $ftOutputFormats)) && $nativeJson == true) {
+			$features = $wfs->getFeatureById($collection, 'application/json; subtype=geojson', $item, "2.0.0", "EPSG:4326");
+			$geojsonList = json_decode($features);
+			$geojsonBbox = array();
+			$geojsonIndex = 0;
+			$minxFC = 90;
+			$minyFC = 180;
+			$maxxFC = -90;
+			$maxyFC = -180;
+			$minxF = 90;
+			$minyF = 180;
+			$maxxF = -90;
+			$maxyF = -180;
+ 			if ($f == 'html'){
+			    $geoJsonVariable = "";
+			    $geoJsonVariable .= '<script>'.$newline;
+			}
+			//read geojson to calculate bboxes
+			foreach ($geojsonList->features as $feature) {
+			    $minxF = 90;
+			    $minyF = 180;
+			    $maxxF = -90;
+			    $maxyF = -180;
+			    switch ($feature->geometry->type) {
+				case "Polygon":
+				    foreach ($feature->geometry->coordinates[0] as $lonLat){
+					$lon = $lonLat[0];
+					$lat = $lonLat[1];
+					if ($minxF > $lat) {
+					    $minxF = $lat;
+					}
+					if ($minyF > $lon) {
+					    $minyF = $lon;
+					}
+					if ($maxxF < $lat) {
+					    $maxxF = $lat;
+					}
+					if ($maxyF < $lon){
+					    $maxyF = $lon;
+					}
+				    }
+				    break;
+				case "Point":
+				    $lon = $feature->geometry->coordinates[0];
+				    $lat = $feature->geometry->coordinates[1];
+				    if ($minxF > $lat) {
+					$minxF = $lat;
+				    }    
+				    if ($minyF > $lon) {
+					$minyF = $lon;
+				    }
+				    if ($maxxF < $lat) {
+					$maxxF = $lat;
+				    }
+				    if ($maxyF < $lon){
+					$maxyF = $lon;
+				    }
+				    break;
+				case "LineString":
+				    foreach ($feature->geometry->coordinates as $lonLat){
+					$lon = $lonLat[0];
+					$lat = $lonLat[1];
+					if ($minxF > $lat) {
+					    $minxF = $lat;
+					}
+					if ($minyF > $lon) {
+					    $minyF = $lon;
+					}
+					if ($maxxF < $lat) {
+					   $maxxF = $lat;
+					}
+					if ($maxyF < $lon){
+					    $maxyF = $lon;
+					}
+				    }
+				    break;
+				} 
+				if ($minxFC > $minxF) {
+				    $minxFC = $minxF;
+				}
+				if ($minyFC > $minyF) {
+				    $minyFC = $minyF;
+				}
+				if ($maxxFC < $maxxF) {
+				   $maxxFC = $maxxF;
+				}
+				if ($maxyFC < $maxyF){
+				    $maxyFC = $maxyF;
+				}
+				$geojsonBbox[$geojsonIndex]->minx = $minxF;
+				$geojsonBbox[$geojsonIndex]->miny = $minyF;
+				$geojsonBbox[$geojsonIndex]->maxx = $maxxF;
+				$geojsonBbox[$geojsonIndex]->maxy = $maxyF;
+				$geomType = $feature->geometry->type;
+			        $geojsonIndex++;
+			    }
+			} else {
+			    $features = $wfs->getFeatureById($collection, 'text/xml; subtype=gml/3.1.1', $item, "2.0.0", "EPSG:4326");
+			    //transform to geojson to allow rendering !
+			    //TODO test for ows:ExceptionReport!!!!
+			    $gml3Class = new Gml_3_Factory();
+			    //create featuretype object
+			    //TODO	
+			    $gml3Object = $gml3Class->createFromXml($features, null, $wfs, $myFeatureType, $geomColumnName);
+			    $geojsonList = new stdClass();
+			    $geojsonList->type = "FeatureCollection";
+			    $geojsonList->features = array();
+			    $geojsonBbox = array();
+			    $geojsonIndex = 0;
+			    $minxFC = 90;
+			    $minyFC = 180;
+			    $maxxFC = -90;
+			    $maxyFC = -180;
+			    //TODO write javascript object if to var if html is requested
+			    if ($f == 'html'){
+				$geoJsonVariable = "";
+				$geoJsonVariable .= '<script>'.$newline;
+			    }
+			    foreach($gml3Object->featureCollection->featureArray as $mbFeature) {
+			        //bbox
+			        $geojsonBbox[$geojsonIndex]->mbBbox = $mbFeature->getBbox();
+			        //transform to simple bbox object for leaflet
+				$bbox_new = explode(' ',str_replace(']','',str_replace('[','',$geojsonBbox[$geojsonIndex]->mbBbox)));
+				$bbox_new = explode('|',str_replace(')','',str_replace('(','',str_replace(')(','|',$bbox_new[0]))));
+				$bbox_min = explode(',',$bbox_new[0]);
+				$bbox_max = explode(',',$bbox_new[1]);
+				$geojsonBbox[$geojsonIndex]->minx = $bbox_min[0];
+				$geojsonBbox[$geojsonIndex]->miny = $bbox_min[1];
+				$geojsonBbox[$geojsonIndex]->maxx = $bbox_max[0];
+				$geojsonBbox[$geojsonIndex]->maxy = $bbox_max[1];
+				if ($minxFC > $geojsonBbox[$geojsonIndex]->minx) {
+				    $minxFC = $geojsonBbox[$geojsonIndex]->minx;
+				}
+				if ($minyFC > $geojsonBbox[$geojsonIndex]->miny) {
+				    $minyFC = $geojsonBbox[$geojsonIndex]->miny;
+				}
+				if ($maxxFC < $geojsonBbox[$geojsonIndex]->maxx) {
+				    $maxxFC = $geojsonBbox[$geojsonIndex]->maxx;
+				}
+				if ($maxyFC < $geojsonBbox[$geojsonIndex]->maxy){
+				    $maxyFC = $geojsonBbox[$geojsonIndex]->maxy;
+				}
+				//get geomtype
+				$geomType = json_decode($mbFeature->toGeoJSON())->geometry->type;
+				$geojsonList->features[] = json_decode($mbFeature->toGeoJSON());
+				$geojsonIndex++;
+			    }
+			}//end if of supported and requested json format
+			if ($f == 'html'){
+			    $geoJsonVariable .= "var feature_".$geomType."=".json_encode($geojsonList).";";
+			    $geoJsonVariable .= $newline."</script>".$newline;
+		        }
+			$usedProxyTime = microtime_float() - $proxyStartTime;
+			$returnObject = $geojsonList->features[0];
+			//add service title and collection title for navigation
+			//for rlp
+			$returnObject->serviceTitle = $wfs->title;
+			$returnObject->collectionId = $myFeatureType->id;
+			$returnObject->collectionName = $ftName;
+			$returnObject->collectionTitle = $myFeatureType->title;
+			//end rlp specific
+		    	$returnObject->links[0]->href =  $_SERVER['REQUEST_URI'];
+		   	$returnObject->links[0]->rel =  "self";
+		   	$returnObject->links[0]->type = "application/geo+json";
+		   	$returnObject->links[0]->title = "this document";
+
+		        $returnObject->links[1]->href =  $_SERVER['REQUEST_URI'];
+		        $returnObject->links[1]->rel =  "alternate";
+		        $returnObject->links[1]->type = "text/html";
+		        $returnObject->links[1]->title = "this document as HTML";
+
+		        $returnObject->links[2]->href =  $_SERVER['REQUEST_URI'];
+		        $returnObject->links[2]->rel =  "alternate";
+		        $returnObject->links[2]->type = "application/gml+xml;profile=\"http://www.opengis.net/def/profile/ogc/2.0/gml-sf2\";version=3.2";
+		        $returnObject->links[2]->title = "this document as GML";
+		    }
 	    } else {
 		$returnObject->success = false;
     	        $returnObject->message = "Collection/Featuretype not available in service!";
@@ -635,6 +814,8 @@
 	header("application/json");
 	echo json_encode($returnObject);
 	break;
+    case "xml":
+	break;
     case "html":
 	$js1 = '<script>'.$newline;
 	//https://stackoverflow.com/questions/5997450/append-to-url-and-refresh-page
@@ -732,23 +913,38 @@
 	//
 	if (!isset($wfsid)){ // && (!isset($collection) || ($collections != 'all'))) {
 	    $html .= '<li class="breadcrumb-item active">Datasets</li>'.$newline;
+            $html .= '</ol>';
 	} else {
 	    if (!isset($collection) || $collections == 'all') {
 	        $html .= '<li class="breadcrumb-item"><a href="'.delTotalFromQuery("wfsid", $_SERVER['REQUEST_URI']).'">Datasets</a></li>'.$newline; //TODO - use base uri
                 $html .= '<li class="breadcrumb-item active">'.$returnObject->title.'</li>'.$newline;
+                $html .= '</ol>';
 	    } else {
 		if (!isset($item) || $items == 'all') {
 		    $html .= '<li class="breadcrumb-item"><a href="'.delTotalFromQuery(array("wfsid","collection","collections","item","items","limit","offset","bbox"), $_SERVER['REQUEST_URI']).'">Datasets</a></li>'.$newline; //TODO - use base uri
                     $html .= '<li class="breadcrumb-item"><a href="'.delTotalFromQuery(array("collection","collections","item","items","limit","offset","bbox"), $_SERVER['REQUEST_URI']).'">'.$returnObject->serviceTitle.'</a></li>'.$newline;
                     $html .= '<li class="breadcrumb-item active">'.$returnObject->collectionTitle.'</li>'.$newline;
+                    $html .= '</ol>';
+		} else {
+		    $html .= '<li class="breadcrumb-item"><a href="'.delTotalFromQuery(array("wfsid","collection","collections","item","items","limit","offset","bbox"), $_SERVER['REQUEST_URI']).'">Datasets</a></li>'.$newline; //TODO - use base uri
+                    $html .= '<li class="breadcrumb-item"><a href="'.delTotalFromQuery(array("collection","collections","item","items","limit","offset","bbox"), $_SERVER['REQUEST_URI']).'">'.$returnObject->serviceTitle.'</a></li>'.$newline;
+		    $html .= '<li class="breadcrumb-item"><a href="'.delTotalFromQuery(array("item","limit","offset","bbox"), $_SERVER['REQUEST_URI']).'&items=all'.'">'.$returnObject->collectionTitle.'</a></li>'.$newline;
+                    $html .= '<li class="breadcrumb-item active">'.$returnObject->id.'</li>'.$newline;
+                    $html .= '</ol>';
 		}
 	    }
-	    /* other formats ! for collection, item, ...
-            <ul class="list-separated m-0 p-0 text-muted">
-                        <li><a href="https://www.ldproxy.nrw.de/topographie/collections/ax_bergbaubetrieb/items?f=json" target="_blank">GeoJSON</a></li>
-                        <li><a href="https://www.ldproxy.nrw.de/topographie/collections/ax_bergbaubetrieb/items?f=xml" target="_blank">GML</a></li>
-            </ul> 
-            */
+	    // other formats ! for collection, item, ...
+	    //if (!isset($item)) {
+                $html .= '<ul class="list-separated m-0 p-0 text-muted">'.$newline;
+                $html .= '    <li><a href="'.delTotalFromQuery("f", $_SERVER['REQUEST_URI']).'&f=json" target="_blank">GeoJSON</a></li>'.$newline;
+		if (isset($collection) || $collections == 'all') {
+                    $html .= '    <li><a href="'.delTotalFromQuery("f", $_SERVER['REQUEST_URI']).'&f=xml" target="_blank">GML</a></li>'.$newline;
+		} else {
+			$html .= '    <li><a href="'.delTotalFromQuery("f", $_SERVER['REQUEST_URI']).'&f=xml" target="_blank">XML</a></li>'.$newline;
+		}
+                $html .= '</ul> '.$newline;
+	    //}
+            //
 	}
 	//
 	$html .= '</ol>'.$newline;
@@ -868,8 +1064,10 @@
 		$html .= '</div>'.$newline;		
 	    } else {
 		//collection is selected - show items 
-		if (!isset($item) || $items == 'all') {
+		//if (!isset($item) || $items == 'all') { //new for items and itemlists!
+
 		    $html .= '<div class="container py-4">'.$newline;	
+if (!isset($item) || $items == "all") {
 		    $html .= '    <div>'.$newline;
 		    $html .= '        <h1>'.$returnObject->collectionTitle.' ('.$numberOfObjects.')'.'</h1>'.$newline;
 		    $html .= '        <span></span>'.$newline;
@@ -923,52 +1121,74 @@
 		    $html .= '</div>'.$newline;
 		    $html .= '</div>'.$newline;
 		    $html .= '</div>'.$newline;
+}
 		    //Navigation elements
 		    $html .= '    <div class="row">'.$newline;
 		    $html .= '        <div class="col-md-6">'.$newline;
-		    //generate page navigation
-		    $nav = "";
-		    $nav .= '            <nav>'.$newline;
-		    $nav .= '                <ul class="pagination mb-4">'.$newline;
-		    //get next link from returned object
-		    foreach ($returnObject->links as $link) {
-		        if ($link->rel == 'next') {
-			    $nextItemsHtmlUrl = delTotalFromQuery("f", $link->href)."&f=html";
-		        }
-		        if ($link->rel == 'last') {
-			    $lastItemsHtmlUrl = delTotalFromQuery("f", $link->href)."&f=html";
-		        }
-		    }
-		    //calculate current page number from offset 	
-		    //
-	            $page = floor($offset / $limit);
-		    $nav .= '                    <li class="page-item"><a class="page-link" href="'.delTotalFromQuery(array('offset'), $nextItemsHtmlUrl).'&offset=0">first page</a></li>'.$newline;
-		    if ($offset > 0) {
-	                $nav .= '                    <li class="page-item">';
-		    } else {
-			$nav .= '                    <li class="page-item disabled">';
-		    }
-		    $nav .= '<a class="page-link" href="'.delTotalFromQuery(array('offset'), $nextItemsHtmlUrl).'&offset='.($offset - $limit).'">‹</a></li>'.$newline;
-		    $nav .= '                    <li class="page-item active"><a class="page-link" href="">'.($page + 1).' ('.($numberOfPages).')</a></li>'.$newline;
-		    //only activate next when page < numberOfPages
-		    if ($page < ($numberOfPages - 1)) {
-		        $nav .= '                    <li class="page-item"><a class="page-link" href="'.$nextItemsHtmlUrl.'">›</a></li>'.$newline;
-		    } else {
-			$nav .= '                    <li class="page-item disabled"><a class="page-link" href="'.$nextItemsHtmlUrl.'">›</a></li>'.$newline;
-                    }
-		    //last page
-		    $nav .= '                    <li class="page-item"><a class="page-link" href="'.$lastItemsHtmlUrl.'">last page</a></li>'.$newline;
-		    $nav .= '                </ul>'.$newline;
-		    $nav .= '            </nav>'.$newline;
-		    //end navigation elements
-		    $html .= $nav;
-		    $html .= '           <ul class="list-unstyled">'.$newline;
-		    $objIndex = 0;
-		    foreach($returnObject->features as $feature) {
-		        $html .= '                <li>'.$newline;
-		        $html .= '                    <div  itemscope itemtype="http://schema.org/Place">'.$newline;
-			$html .= '                        <h4 class="mt-3 mb-1"><a href="'.delTotalFromQuery(array('items','offset','limit','bbox'),$_SERVER['REQUEST_URI']).'&item='.$feature->id.'" target="_blank"><span itemprop="name">'.$feature->id.'</span></a></h4><a href=""  onclick="zoomToExtent('.$geojsonBbox[$objIndex]->minx.",".$geojsonBbox[$objIndex]->miny.",".$geojsonBbox[$objIndex]->maxx.",".$geojsonBbox[$objIndex]->maxy.');return false;">zoom to</a>'.$newline;
-        		$html .= '                        <span class="d-none" itemprop="sameAs">https://www.ldproxy.nrw.de/topographie/collections/ax_bergbaubetrieb/items/DENWAT01D000CcF0</span>'.$newline;
+		    if (!isset($item) || $items == 'all') {
+                            //generate page navigation**********************************************************************************************************************************************************
+			    $nav = "";
+			    $nav .= '            <nav>'.$newline;
+			    $nav .= '                <ul class="pagination mb-4">'.$newline;
+			    //get next link from returned object
+			    foreach ($returnObject->links as $link) {
+				if ($link->rel == 'next') {
+				    $nextItemsHtmlUrl = delTotalFromQuery("f", $link->href)."&f=html";
+				}
+				if ($link->rel == 'last') {
+				    $lastItemsHtmlUrl = delTotalFromQuery("f", $link->href)."&f=html";
+				}
+			    }
+			    //calculate current page number from offset 	
+			    //
+			    $page = floor($offset / $limit);
+			    $nav .= '                    <li class="page-item"><a class="page-link" href="'.delTotalFromQuery(array('offset'), $nextItemsHtmlUrl).'&offset=0">first page</a></li>'.$newline;
+			    if ($offset > 0) {
+			        $nav .= '                    <li class="page-item">';
+			    } else {
+				$nav .= '                    <li class="page-item disabled">';
+			    }
+			    $nav .= '<a class="page-link" href="'.delTotalFromQuery(array('offset'), $nextItemsHtmlUrl).'&offset='.($offset - $limit).'">‹</a></li>'.$newline;
+			    $nav .= '                    <li class="page-item active"><a class="page-link" href="">'.($page + 1).' ('.($numberOfPages).')</a></li>'.$newline;
+			    //only activate next when page < numberOfPages
+			    if ($page < ($numberOfPages - 1)) {
+				$nav .= '                    <li class="page-item"><a class="page-link" href="'.$nextItemsHtmlUrl.'">›</a></li>'.$newline;
+			    } else {
+				$nav .= '                    <li class="page-item disabled"><a class="page-link" href="'.$nextItemsHtmlUrl.'">›</a></li>'.$newline;
+		            }
+			    //last page
+			    $nav .= '                    <li class="page-item"><a class="page-link" href="'.$lastItemsHtmlUrl.'">last page</a></li>'.$newline;
+			    $nav .= '                </ul>'.$newline;
+			    $nav .= '            </nav>'.$newline;
+			    //end navigation elements
+			    $html .= $nav;
+			    //end page navigation**********************************************************************************************************************************************************
+			    $html .= '           <ul class="list-unstyled">'.$newline;
+			    $objIndex = 0;
+			    foreach($returnObject->features as $feature) {
+				$html .= '                <li>'.$newline;
+				$html .= '                    <div  itemscope itemtype="http://schema.org/Place">'.$newline;
+				$html .= '                        <h4 class="mt-3 mb-1"><a href="'.delTotalFromQuery(array('items','offset','limit','bbox'),$_SERVER['REQUEST_URI']).'&item='.$feature->id.'" target="_blank"><span itemprop="name">'.$feature->id.'</span></a></h4><a href=""  onclick="zoomToExtent('.$geojsonBbox[$objIndex]->minx.",".$geojsonBbox[$objIndex]->miny.",".$geojsonBbox[$objIndex]->maxx.",".$geojsonBbox[$objIndex]->maxy.');return false;">zoom to</a>'.$newline;
+				$html .= '                        <span class="d-none" itemprop="sameAs">https://www.ldproxy.nrw.de/topographie/collections/ax_bergbaubetrieb/items/DENWAT01D000CcF0</span>'.$newline;
+				//foreach attribute
+				foreach($feature->properties as $key=>$value) {
+				    $html .= '                        <div class="row my-1">'.$newline;
+				    $html .= '                            <div class="col-md-6 font-weight-bold text-truncate" title="'.$key.'">'.$key.'</div>'.$newline;
+				    $html .= '                            <div class="col-md-6" >'.string2html($value).'</div>'.$newline;
+				    $html .= '                        </div>'.$newline;
+				}
+				$html .= '                    </div>'.$newline;
+				$html .= '                </li>'.$newline;
+				$objIndex++;
+			    }
+			    $html .= '            </ul>'.$newline;
+			    $html .= $nav;
+                    } else {
+			//only one feature is found!
+			$feature = $returnObject;
+			$html .= '                    <div  itemscope itemtype="http://schema.org/Place">'.$newline;
+			$html .= '                        <h1 itemprop="name">'.$feature->id.'</h1>'.$newline;
+			$html .= '                        <span class="d-none" itemprop="url">'.$_SERVER['REQUEST_URI'].'</span>'.$newline;
 			//foreach attribute
 			foreach($feature->properties as $key=>$value) {
 			    $html .= '                        <div class="row my-1">'.$newline;
@@ -977,11 +1197,7 @@
 			    $html .= '                        </div>'.$newline;
 			}
 			$html .= '                    </div>'.$newline;
-			$html .= '                </li>'.$newline;
-			$objIndex++;
 		    }
-		    $html .= '            </ul>'.$newline;
-		    $html .= $nav;
 	            $html .= '    </div>'.$newline;
 	            $html .= '<!-- functions to handle url parameters -->'.$newline;
 		    $js1 = '    <script>'.$newline;
@@ -1055,7 +1271,7 @@
 	            $html .= '<!-- functions to render vectors and extent managing -->'.$newline;
 		    $js3 = "    <script>".$newline;
 		    $js3 .= "	function onEachFeature(feature, layer) {";
-		    $js3 .= "		var popupContent = \"<p><b>\"+ feature.id + \"(\" +";
+		    $js3 .= "		var popupContent = \"<p><b>\"+ feature.id + \" (\" +";
 		    $js3 .= "				feature.geometry.type + \")</b></p>\";";
 		    $js3 .= "		if (feature.properties && feature.properties.popupContent) {";
 		    $js3 .= "			popupContent += feature.properties.popupContent;";
@@ -1109,7 +1325,7 @@
 		    //add geojson object from page
 		    //$html .= $geojsonVariable.$newline;
 		    $html .= $js3;
-		} else {
+		/*} else {
 		    //item is set !
 		    //$html .= '<div id="feature_table">';
 		    //header("Content-Type: application/gml+xml;version=3.1");
@@ -1116,7 +1332,7 @@
 		    header("Content-Type: ".$outputFormat);
 		    echo $wfs->getFeatureById($collection, $outputFormat, $item, "2.0.0", "EPSG:4326");
 		    die();
-		}
+		}*/
 	    }
 	}
 	//************************************************************************************************************************************	



More information about the Mapbender_commits mailing list