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

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Tue Oct 1 23:41:03 PDT 2019


Author: armin11
Date: 2019-10-01 23:41:03 -0700 (Tue, 01 Oct 2019)
New Revision: 10276

Modified:
   trunk/mapbender/http/php/mod_linkedDataProxy.php
Log:
New version with openapi 3.0 description in json

Modified: trunk/mapbender/http/php/mod_linkedDataProxy.php
===================================================================
--- trunk/mapbender/http/php/mod_linkedDataProxy.php	2019-10-01 20:54:01 UTC (rev 10275)
+++ trunk/mapbender/http/php/mod_linkedDataProxy.php	2019-10-02 06:41:03 UTC (rev 10276)
@@ -116,7 +116,7 @@
 //outputFormat for pages - parameter f=...
 $allowedFormats = array("html","xml","json");
 //	
-$newline = "\n";
+$newline = " ";
 function microtime_float() {
     	list($usec, $sec) = explode(" ", microtime());
     	return ((float)$usec + (float)$sec);
@@ -180,6 +180,385 @@
     } 
 }
 
+function getOpenApi3JsonComponentTemplate() {
+$openApi3JsonComponent = <<<JSON
+{  "components" : {
+    "schemas" : {
+      "exception" : {
+        "required" : [ "code" ],
+        "type" : "object",
+        "properties" : {
+          "code" : {
+            "type" : "string"
+          },
+          "description" : {
+            "type" : "string"
+          }
+        }
+      },
+      "root" : {
+        "required" : [ "links" ],
+        "type" : "object",
+        "properties" : {
+          "links" : {
+            "type" : "array",
+            "example" : [ {
+              "href" : "http://data.example.org/",
+              "rel" : "self",
+              "type" : "application/json",
+              "title" : "this document"
+            }, {
+              "href" : "http://data.example.org/api",
+              "rel" : "service",
+              "type" : "application/openapi+json;version=3.0",
+              "title" : "the API definition"
+            }, {
+              "href" : "http://data.example.org/conformance",
+              "rel" : "conformance",
+              "type" : "application/json",
+              "title" : "WFS 3.0 conformance classes implemented by this server"
+            }, {
+              "href" : "http://data.example.org/collections",
+              "rel" : "data",
+              "type" : "application/json",
+              "title" : "Metadata about the feature collections"
+            } ],
+            "items" : {
+              "\$ref" : "#/components/schemas/link"
+            }
+          }
+        }
+      },
+      "req-classes" : {
+        "required" : [ "conformsTo" ],
+        "type" : "object",
+        "properties" : {
+          "conformsTo" : {
+            "type" : "array",
+            "example" : [ "http://www.opengis.net/spec/wfs-1/3.0/req/core", "http://www.opengis.net/spec/wfs-1/3.0/req/oas30", "http://www.opengis.net/spec/wfs-1/3.0/req/html", "http://www.opengis.net/spec/wfs-1/3.0/req/geojson" ],
+            "items" : {
+              "type" : "string"
+            }
+          }
+        }
+      },
+      "link" : {
+        "required" : [ "href" ],
+        "type" : "object",
+        "properties" : {
+          "href" : {
+            "type" : "string",
+            "example" : "http://data.example.com/buildings/123"
+          },
+          "rel" : {
+            "type" : "string",
+            "example" : "prev"
+          },
+          "type" : {
+            "type" : "string",
+            "example" : "application/geo+json"
+          },
+          "hreflang" : {
+            "type" : "string",
+            "example" : "en"
+          }
+        }
+      },
+      "content" : {
+        "required" : [ "collections", "links" ],
+        "type" : "object",
+        "properties" : {
+          "links" : {
+            "type" : "array",
+            "example" : [ {
+              "href" : "http://data.example.org/collections.json",
+              "rel" : "self",
+              "type" : "application/json",
+              "title" : "this document"
+            }, {
+              "href" : "http://data.example.org/collections.html",
+              "rel" : "alternate",
+              "type" : "text/html",
+              "title" : "this document as HTML"
+            }, {
+              "href" : "http://schemas.example.org/1.0/foobar.xsd",
+              "rel" : "describedBy",
+              "type" : "application/xml",
+              "title" : "XML schema for Acme Corporation data"
+            } ],
+            "items" : {
+              "\$ref" : "#/components/schemas/link"
+            }
+          },
+          "collections" : {
+            "type" : "array",
+            "items" : {
+              "\$ref" : "#/components/schemas/collectionInfo"
+            }
+          }
+        }
+      },
+      "collectionInfo" : {
+        "required" : [ "links", "name" ],
+        "type" : "object",
+        "properties" : {
+          "name" : {
+            "type" : "string",
+            "description" : "identifier of the collection used, for example, in URIs",
+            "example" : "buildings"
+          },
+          "title" : {
+            "type" : "string",
+            "description" : "human readable title of the collection",
+            "example" : "Buildings"
+          },
+          "description" : {
+            "type" : "string",
+            "description" : "a description of the features in the collection",
+            "example" : "Buildings in the city of Bonn."
+          },
+          "links" : {
+            "type" : "array",
+            "example" : [ {
+              "href" : "http://data.example.org/collections/buildings/items",
+              "rel" : "item",
+              "type" : "application/geo+json",
+              "title" : "Buildings"
+            }, {
+              "href" : "http://example.com/concepts/buildings.html",
+              "rel" : "describedBy",
+              "type" : "text/html",
+              "title" : "Feature catalogue for buildings"
+            } ],
+            "items" : {
+              "\$ref" : "#/components/schemas/link"
+            }
+          },
+          "extent" : {
+            "\$ref" : "#/components/schemas/extent"
+          },
+          "crs" : {
+            "type" : "array",
+            "description" : "The coordinate reference systems in which geometries may be retrieved. Coordinate reference systems are identified by a URI. The first coordinate reference system is the coordinate reference system that is used by default. This is always http://www.opengis.net/def/crs/OGC/1.3/CRS84, i.e. WGS84 longitude/latitude.",
+            "example" : [ "http://www.opengis.net/def/crs/OGC/1.3/CRS84", "http://www.opengis.net/def/crs/EPSG/0/4326" ],
+            "items" : {
+              "type" : "string"
+            },
+            "default" : [ "http://www.opengis.net/def/crs/OGC/1.3/CRS84" ]
+          },
+          "relations" : {
+            "type" : "object",
+            "description" : "Related collections that may be retrieved for this collection",
+            "example" : "{'id': 'label'}"
+          }
+        }
+      },
+      "extent" : {
+        "required" : [ "spatial" ],
+        "type" : "object",
+        "properties" : {
+          "crs" : {
+            "type" : "string",
+            "description" : "Coordinate reference system of the coordinates in the spatial extent (property spatial). In the Core, only WGS84 longitude/latitude is supported. Extensions may support additional coordinate reference systems.",
+            "enum" : [ "http://www.opengis.net/def/crs/OGC/1.3/CRS84" ],
+            "default" : "http://www.opengis.net/def/crs/OGC/1.3/CRS84"
+          },
+          "spatial" : {
+            "maxItems" : 6,
+            "minItems" : 4,
+            "type" : "array",
+            "description" : "West, north, east, south edges of the spatial extent. The minimum and maximum values apply to the coordinate reference system WGS84 longitude/latitude that is supported in the Core. If, for example, a projected coordinate reference system is used, the minimum and maximum values need to be adjusted.",
+            "example" : [ -180, -90, 180, 90 ],
+            "items" : {
+              "type" : "number"
+            }
+          }
+        }
+      },
+      "featureCollectionGeoJSON" : {
+        "required" : [ "features", "type" ],
+        "type" : "object",
+        "properties" : {
+          "type" : {
+            "type" : "string",
+            "enum" : [ "FeatureCollection" ]
+          },
+          "features" : {
+            "type" : "array",
+            "items" : {
+              "\$ref" : "#/components/schemas/featureGeoJSON"
+            }
+          },
+          "links" : {
+            "type" : "array",
+            "items" : {
+              "\$ref" : "#/components/schemas/link"
+            }
+          },
+          "timeStamp" : {
+            "type" : "string",
+            "format" : "dateTime"
+          },
+          "numberMatched" : {
+            "minimum" : 0,
+            "type" : "integer"
+          },
+          "numberReturned" : {
+            "minimum" : 0,
+            "type" : "integer"
+          }
+        }
+      },
+      "featureGeoJSON" : {
+        "required" : [ "geometry", "properties", "type" ],
+        "type" : "object",
+        "properties" : {
+          "type" : {
+            "type" : "string",
+            "enum" : [ "Feature" ]
+          },
+          "geometry" : {
+            "\$ref" : "#/components/schemas/geometryGeoJSON"
+          },
+          "properties" : {
+            "type" : "object",
+            "nullable" : true
+          },
+          "id" : {
+            "oneOf" : [ {
+              "type" : "string"
+            }, {
+              "type" : "integer"
+            } ]
+          }
+        }
+      },
+      "geometryGeoJSON" : {
+        "required" : [ "type" ],
+        "type" : "object",
+        "properties" : {
+          "type" : {
+            "type" : "string",
+            "enum" : [ "Point", "MultiPoint", "LineString", "MultiLineString", "Polygon", "MultiPolygon", "GeometryCollection" ]
+          }
+        }
+      }
+    },
+    "parameters" : {
+      "f" : {
+        "name" : "f",
+        "in" : "query",
+        "description" : "The format of the response. If no value is provided, the standard http rules apply, i.e., the accept header shall be used to determine the format. Pre-defined values are xml, json and html. The response to other  values is determined by the server.",
+        "required" : false,
+        "style" : "form",
+        "explode" : false,
+        "schema" : {
+          "type" : "string",
+          "enum" : [ "json", "xml", "html" ]
+        },
+        "example" : "json"
+      },
+      "limit" : {
+        "name" : "limit",
+        "in" : "query",
+        "description" : "The optional limit parameter limits the number of items that are presented in the response document.Only items are counted that are on the first level of the collection in the response document.  Nested objects contained within the explicitly requested items shall not be counted.Minimum = 1. Maximum = 10000. Default = 10.",
+        "required" : false,
+        "style" : "form",
+        "explode" : false,
+        "schema" : {
+          "maximum" : 10000,
+          "minimum" : 1,
+          "type" : "integer",
+          "default" : 10
+        },
+        "example" : 10
+      },
+      "offset" : {
+        "name" : "offset",
+        "in" : "query",
+        "description" : "The optional offset parameter indicates the index within the result set from which the server shall begin presenting results in the response document. The first element has an index of 0. Minimum = 0. Default = 0.",
+        "required" : false,
+        "style" : "form",
+        "explode" : false,
+        "schema" : {
+          "minimum" : 0,
+          "type" : "integer",
+          "default" : 0
+        },
+        "example" : 0
+      },
+      "bbox" : {
+        "name" : "bbox",
+        "in" : "query",
+        "description" : "Only features that have a geometry that intersects the bounding box are selected. The bounding box is provided as four or six numbers, depending on whether the coordinate reference system includes a vertical axis (elevation or depth):   * Lower left corner, coordinate axis 1 * Lower left corner, coordinate axis 2 * Lower left corner, coordinate axis 3 (optional) * Upper right corner, coordinate axis 1 * Upper right corner, coordinate axis 2 * Upper right corner, coordinate axis 3 (optional)  The coordinate reference system of the values is WGS84 longitude/latitude (http://www.opengis.net/def/crs/OGC/1.3/CRS84) unless a different coordinate reference system is specified in the parameter `bbox-crs`.  For WGS84 longitude/latitude the values are in most cases the sequence of minimum longitude, minimum latitude, maximum longitude and maximum latitude. However, in cases where the box spans the antimeridian the first value (west-most box edge) is larger than the th
 ird value (east-most box edge).  If a feature has multiple spatial geometry properties, it is the decision of the server whether only a single spatial geometry property is used to determine the extent or all relevant geometries.",
+        "required" : false,
+        "style" : "form",
+        "explode" : false,
+        "schema" : {
+          "maxItems" : 6,
+          "minItems" : 4,
+          "type" : "array",
+          "items" : {
+            "type" : "number"
+          }
+        }
+      },
+      "time" : {
+        "name" : "time",
+        "in" : "query",
+        "description" : "Either a date-time or a period string that adheres to RFC 3339. Examples:  * A date-time: 2018-02-12T23:20:50Z * A period: 2018-02-12T00:00:00Z/2018-03-18T12:31:12Z or \"2018-02-12T00:00:00Z/P1M6DT12H31M12S  Only features that have a temporal property that intersects the value of `time` are selected.  If a feature has multiple temporal properties, it is the decision of the server whether only a single temporal property is used to determine the extent or all relevant temporal properties.",
+        "required" : false,
+        "style" : "form",
+        "explode" : false,
+        "schema" : {
+          "type" : "string"
+        }
+      },
+      "resultType" : {
+        "name" : "resultType",
+        "in" : "query",
+        "description" : "This service will respond to a query in one of two ways (excluding an exception response). It may either generate a complete response document containing resources that satisfy the operation or it may simply generate an empty response container that indicates the count of the total number of resources that the operation would return. Which of these two responses is generated is determined by the value of the optional resultType parameter. The allowed values for this parameter are results and hits. If the value of the resultType parameter is set to \"results\", the server will generate a complete response document containing resources that satisfy the operation. If the value of the resultType attribute is set to hits, the server will generate an empty response document containing no resource instances. Default = results.",
+        "required" : false,
+        "style" : "form",
+        "explode" : false,
+        "schema" : {
+          "type" : "string",
+          "enum" : [ "hits", "results" ],
+          "default" : "results"
+        },
+        "example" : "results"
+      },
+      "featureId" : {
+        "name" : "featureId",
+        "in" : "path",
+        "description" : "Local identifier of a specific feature",
+        "required" : true,
+        "schema" : {
+          "type" : "string"
+        }
+      },
+      "properties" : {
+        "name" : "properties",
+        "in" : "query",
+        "description" : "The properties that should be included for each feature. The parameter value is a comma-separated list of property names.",
+        "required" : false,
+        "style" : "form",
+        "explode" : false,
+        "schema" : {
+          "type" : "array",
+          "items" : {
+            "type" : "string"
+          }
+        }
+      }
+    }
+  }
+}
+JSON;
+    return $openApi3JsonComponent;
+}
+
+
 //TODO - built function to map get parameters back to combined rest/get uri
 // wfsid=...&collection=....&item=...&f=html -> /linkedDataProxy/{wfsid}/collections/{collectionId}/items/{itemId}?f=html
 //uri of proxy have to be given absolute? - 
@@ -216,6 +595,9 @@
 	    /*if (isset($requestArray['getapidescription']) && $requestArray['getapidescription'] == "true") {
 		$apiPath .= "/api/";
 	    }*/
+	    if ($requestArray['collections'] == "api") {
+		        $apiPath .= "/api";
+	    }
 	    if (isset($requestArray['collection']) && $requestArray['collection'] != "") {
 		if ($requestArray['collection'] == "all") {
 		    $apiPath .= "/collections";
@@ -227,9 +609,6 @@
 		if ($requestArray['items'] == "all") {
 		    $apiPath .= "/items";
 		}
-		if ($requestArray['items'] == "api") {
-		    $apiPath .= "/api/";
-		}
 	    }
 	    if (isset($requestArray['item']) && $requestArray['item'] != "") {
 		    $apiPath .= "/items/".$requestArray['item'];
@@ -281,12 +660,17 @@
             //$apiParamsArray["wfsid"] = $requestParams[0];
             break;
         case "2":
-            if ($requestParams[1] == "collections") {
-                $_REQUEST["wfsid"] = $requestParams[0]; 
-                $_REQUEST["collections"] = "all";
-            } else {		
-		echo 'URI not valid! {wfsid}/collection<br/>'; 
-		die(); 
+	    if ($requestParams[1] == "api") {
+		$_REQUEST["wfsid"] = $requestParams[0];
+		$_REQUEST["collections"] = "api";
+	    } else {
+                if ($requestParams[1] == "collections") {
+                    $_REQUEST["wfsid"] = $requestParams[0]; 
+                    $_REQUEST["collections"] = "all";
+                } else {		
+		    echo 'URI not valid! {wfsid}/collection or {wfsid}/api<br/>'; 
+		    die(); 
+	        }
 	    }
             break;
         case "3":
@@ -564,22 +948,70 @@
 	$returnObject->success = false;
     	$returnObject->message = "Wfs object could not be created from db!";
     } else {
+	//repair some missing wfs data
+	if (!isset($wfs->summary) || $wfs->summary == null || $wfs->summary == "") {
+		$wfs->summary = "WFS description is missing!";
+	}
+	if (!isset($wfs->providerName) || $wfs->providerName == null || $wfs->providerName == "") {
+		$wfs->providerName = "WFS providername is missing!";
+	}
+	if (!isset($wfs->electronicMailAddress) || $wfs->electronicMailAddress == null || $wfs->electronicMailAddress == "") {
+		$wfs->electronicMailAddress = "test at test.org";
+	}
+	if (!isset($wfs->electronicMailAddress) || $wfs->electronicMailAddress == null || $wfs->electronicMailAddress == "") {
+		$wfs->electronicMailAddress = "test at test.org";
+	}
+	if (!isset($wfs->fees) || $wfs->fees == null || $wfs->fees == "") {
+		$wfs->fees = "No fees are given in WFS Capabilities!";
+	}
 	//create service part if no collection is requested		
 	if (!isset($collection) || $collection == "" || $collections == "all" || $collections == "api") {
+            //************************************************************************************************************************************
+            //service only part 
+            //************************************************************************************************************************************
+	    //add from rlp!
+	    $returnObject->id = $wfsid;
+            $returnObject->title = $wfs->title;
+	    $returnObject->description = $wfs->summary;
+	    $returnObject->provider = $wfs->providerName;
+	    $returnObject->providerEmail = $wfs->electronicMailAddress;
+	    //$returnObject->providerHomepage = $wfs->homepage; //TODO add to ows class!
+            $returnObject->providerHomepage = "https://www.geoportal.rlp.de/";
+	    $returnObject->license = $wfs->fees;
+
+	    //get contraints
+	    $constraints = new OwsConstraints();
+	    $constraints->languageCode = "de";
+	    $constraints->asTable = true;
+	    $constraints->id = $wfsid;
+	    $constraints->type = "wfs";
+	    $constraints->returnDirect = false;
+	    $tou = $constraints->getDisclaimer();//TODO encoding problems may occur!
+	    if (isset($imagePathReplace)) {
+		$tou = str_replace("../img/", $imagePathReplace, $tou);
+	    }
+	    if ($f == "html") {
+		$returnObject->license = $tou; //- generate license info in json for json format!!!!!
+	    }
+	    $returnObject->accessUrl = $wfs->getCapabilities;
+//uri to test openapi description:
+//https://editor.swagger.io/
 	    if ($collections == "api") {
 		$apiDescriptionJson = new stdClass();
 		$apiDescriptionJson->openapi = "3.0.1";
-		$apiDescriptionJson->info->title = "wfs title";
-		$apiDescriptionJson->info->description = "wfs description";
-		$apiDescriptionJson->contact->name = "wfs description";
-		$apiDescriptionJson->contact->url = "wfs description";
-		$apiDescriptionJson->contact->email = "wfs contact email";
+		$apiDescriptionJson->info->title = $wfs->title;
+		$apiDescriptionJson->info->description = $wfs->summary;
 
-		$apiDescriptionJson->license->name = "wfs description";
-		$apiDescriptionJson->license->version = "wfs description";
+		$apiDescriptionJson->info->contact->name = $wfs->providerName;
+		$apiDescriptionJson->info->contact->url = $returnObject->providerHomepage;
+		$apiDescriptionJson->info->contact->email = $wfs->electronicMailAddress;
 
-		$apiDescriptionJson->servers[0]->url = "server url - ...";
+		$apiDescriptionJson->info->license->name = $wfs->fees;
 
+		$apiDescriptionJson->info->version = "1.0.0";
+
+		$apiDescriptionJson->servers[0]->url = $wfs->getCapabilities;
+
 		$apiDescriptionJson->tags[0]->name = "Capabilities";
 		$apiDescriptionJson->tags[0]->description = "Essential characteristics of this API including information about the data.";
 		$apiDescriptionJson->tags[1]->name = "Features";
@@ -693,483 +1125,14 @@
 			$apiDescriptionJson->paths->{$featuretypePathPart}->get->responses->{'default'}->content->{'text/html'}->schema->{'type'} = "string";
 			//{items}/{featureId}*************************************************************************
 		//path /collections ****************************************************************
+//define template - first use it from ia
+//TODO: remove not used elements
 		}
-/*$iaEampleJson = <<<JSON
-{  "components" : {
-    "schemas" : {
-      "exception" : {
-        "required" : [ "code" ],
-        "type" : "object",
-        "properties" : {
-          "code" : {
-            "type" : "string"
-          },
-          "description" : {
-            "type" : "string"
-          }
-        }
-      },
-      "root" : {
-        "required" : [ "links" ],
-        "type" : "object",
-        "properties" : {
-          "links" : {
-            "type" : "array",
-            "example" : [ {
-              "href" : "http://data.example.org/",
-              "rel" : "self",
-              "type" : "application/json",
-              "title" : "this document"
-            }, {
-              "href" : "http://data.example.org/api",
-              "rel" : "service",
-              "type" : "application/openapi+json;version=3.0",
-              "title" : "the API definition"
-            }, {
-              "href" : "http://data.example.org/conformance",
-              "rel" : "conformance",
-              "type" : "application/json",
-              "title" : "WFS 3.0 conformance classes implemented by this server"
-            }, {
-              "href" : "http://data.example.org/collections",
-              "rel" : "data",
-              "type" : "application/json",
-              "title" : "Metadata about the feature collections"
-            } ],
-            "items" : {
-              "$ref" : "#/components/schemas/link"
-            }
-          }
-        }
-      },
-      "req-classes" : {
-        "required" : [ "conformsTo" ],
-        "type" : "object",
-        "properties" : {
-          "conformsTo" : {
-            "type" : "array",
-            "example" : [ "http://www.opengis.net/spec/wfs-1/3.0/req/core", "http://www.opengis.net/spec/wfs-1/3.0/req/oas30", "http://www.opengis.net/spec/wfs-1/3.0/req/html", "http://www.opengis.net/spec/wfs-1/3.0/req/geojson" ],
-            "items" : {
-              "type" : "string"
-            }
-          }
-        }
-      },
-      "link" : {
-        "required" : [ "href" ],
-        "type" : "object",
-        "properties" : {
-          "href" : {
-            "type" : "string",
-            "example" : "http://data.example.com/buildings/123"
-          },
-          "rel" : {
-            "type" : "string",
-            "example" : "prev"
-          },
-          "type" : {
-            "type" : "string",
-            "example" : "application/geo+json"
-          },
-          "hreflang" : {
-            "type" : "string",
-            "example" : "en"
-          }
-        }
-      },
-      "content" : {
-        "required" : [ "collections", "links" ],
-        "type" : "object",
-        "properties" : {
-          "links" : {
-            "type" : "array",
-            "example" : [ {
-              "href" : "http://data.example.org/collections.json",
-              "rel" : "self",
-              "type" : "application/json",
-              "title" : "this document"
-            }, {
-              "href" : "http://data.example.org/collections.html",
-              "rel" : "alternate",
-              "type" : "text/html",
-              "title" : "this document as HTML"
-            }, {
-              "href" : "http://schemas.example.org/1.0/foobar.xsd",
-              "rel" : "describedBy",
-              "type" : "application/xml",
-              "title" : "XML schema for Acme Corporation data"
-            } ],
-            "items" : {
-              "$ref" : "#/components/schemas/link"
-            }
-          },
-          "collections" : {
-            "type" : "array",
-            "items" : {
-              "$ref" : "#/components/schemas/collectionInfo"
-            }
-          }
-        }
-      },
-      "collectionInfo" : {
-        "required" : [ "links", "name" ],
-        "type" : "object",
-        "properties" : {
-          "name" : {
-            "type" : "string",
-            "description" : "identifier of the collection used, for example, in URIs",
-            "example" : "buildings"
-          },
-          "title" : {
-            "type" : "string",
-            "description" : "human readable title of the collection",
-            "example" : "Buildings"
-          },
-          "description" : {
-            "type" : "string",
-            "description" : "a description of the features in the collection",
-            "example" : "Buildings in the city of Bonn."
-          },
-          "links" : {
-            "type" : "array",
-            "example" : [ {
-              "href" : "http://data.example.org/collections/buildings/items",
-              "rel" : "item",
-              "type" : "application/geo+json",
-              "title" : "Buildings"
-            }, {
-              "href" : "http://example.com/concepts/buildings.html",
-              "rel" : "describedBy",
-              "type" : "text/html",
-              "title" : "Feature catalogue for buildings"
-            } ],
-            "items" : {
-              "$ref" : "#/components/schemas/link"
-            }
-          },
-          "extent" : {
-            "$ref" : "#/components/schemas/extent"
-          },
-          "crs" : {
-            "type" : "array",
-            "description" : "The coordinate reference systems in which geometries may be retrieved. Coordinate reference systems are identified by a URI. The first coordinate reference system is the coordinate reference system that is used by default. This is always \"http://www.opengis.net/def/crs/OGC/1.3/CRS84\", i.e. WGS84 longitude/latitude.",
-            "example" : [ "http://www.opengis.net/def/crs/OGC/1.3/CRS84", "http://www.opengis.net/def/crs/EPSG/0/4326" ],
-            "items" : {
-              "type" : "string"
-            },
-            "default" : [ "http://www.opengis.net/def/crs/OGC/1.3/CRS84" ]
-          },
-          "relations" : {
-            "type" : "object",
-            "description" : "Related collections that may be retrieved for this collection",
-            "example" : "{\"id\": \"label\"}"
-          }
-        }
-      },
-      "extent" : {
-        "required" : [ "spatial" ],
-        "type" : "object",
-        "properties" : {
-          "crs" : {
-            "type" : "string",
-            "description" : "Coordinate reference system of the coordinates in the spatial extent (property `spatial`). In the Core, only WGS84 longitude/latitude is supported. Extensions may support additional coordinate reference systems.",
-            "enum" : [ "http://www.opengis.net/def/crs/OGC/1.3/CRS84" ],
-            "default" : "http://www.opengis.net/def/crs/OGC/1.3/CRS84"
-          },
-          "spatial" : {
-            "maxItems" : 6,
-            "minItems" : 4,
-            "type" : "array",
-            "description" : "West, north, east, south edges of the spatial extent. The minimum and maximum values apply to the coordinate reference system WGS84 longitude/latitude that is supported in the Core. If, for example, a projected coordinate reference system is used, the minimum and maximum values need to be adjusted.",
-            "example" : [ -180, -90, 180, 90 ],
-            "items" : {
-              "type" : "number"
-            }
-          }
-        }
-      },
-      "featureCollectionGeoJSON" : {
-        "required" : [ "features", "type" ],
-        "type" : "object",
-        "properties" : {
-          "type" : {
-            "type" : "string",
-            "enum" : [ "FeatureCollection" ]
-          },
-          "features" : {
-            "type" : "array",
-            "items" : {
-              "$ref" : "#/components/schemas/featureGeoJSON"
-            }
-          },
-          "links" : {
-            "type" : "array",
-            "items" : {
-              "$ref" : "#/components/schemas/link"
-            }
-          },
-          "timeStamp" : {
-            "type" : "string",
-            "format" : "dateTime"
-          },
-          "numberMatched" : {
-            "minimum" : 0,
-            "type" : "integer"
-          },
-          "numberReturned" : {
-            "minimum" : 0,
-            "type" : "integer"
-          }
-        }
-      },
-      "featureGeoJSON" : {
-        "required" : [ "geometry", "properties", "type" ],
-        "type" : "object",
-        "properties" : {
-          "type" : {
-            "type" : "string",
-            "enum" : [ "Feature" ]
-          },
-          "geometry" : {
-            "$ref" : "#/components/schemas/geometryGeoJSON"
-          },
-          "properties" : {
-            "type" : "object",
-            "nullable" : true
-          },
-          "id" : {
-            "oneOf" : [ {
-              "type" : "string"
-            }, {
-              "type" : "integer"
-            } ]
-          }
-        }
-      },
-      "geometryGeoJSON" : {
-        "required" : [ "type" ],
-        "type" : "object",
-        "properties" : {
-          "type" : {
-            "type" : "string",
-            "enum" : [ "Point", "MultiPoint", "LineString", "MultiLineString", "Polygon", "MultiPolygon", "GeometryCollection" ]
-          }
-        }
-      }
-    },
-    "parameters" : {
-      "f" : {
-        "name" : "f",
-        "in" : "query",
-        "description" : "The format of the response. If no value is provided, the standard http rules apply, i.e., the accept header shall be used to determine the format.\\\nPre-defined values are \"xml\", \"json\" and \"html\". The response to other  values is determined by the server.",
-        "required" : false,
-        "style" : "form",
-        "explode" : false,
-        "schema" : {
-          "type" : "string",
-          "enum" : [ "json", "xml", "html" ]
-        },
-        "example" : "json"
-      },
-      "limit" : {
-        "name" : "limit",
-        "in" : "query",
-        "description" : "The optional limit parameter limits the number of items that are presented in the response document.\\\nOnly items are counted that are on the first level of the collection in the response document.  Nested objects contained within the explicitly requested items shall not be counted.\\\nMinimum = 1.\\\nMaximum = 10000.\\\nDefault = 10.",
-        "required" : false,
-        "style" : "form",
-        "explode" : false,
-        "schema" : {
-          "maximum" : 10000,
-          "minimum" : 1,
-          "type" : "integer",
-          "default" : 10
-        },
-        "example" : 10
-      },
-      "offset" : {
-        "name" : "offset",
-        "in" : "query",
-        "description" : "The optional offset parameter indicates the index within the result set from which the server shall begin presenting results in the response document. The first element has an index of 0.\\\nMinimum = 0.\\\nDefault = 0.",
-        "required" : false,
-        "style" : "form",
-        "explode" : false,
-        "schema" : {
-          "minimum" : 0,
-          "type" : "integer",
-          "default" : 0
-        },
-        "example" : 0
-      },
-      "bbox" : {
-        "name" : "bbox",
-        "in" : "query",
-        "description" : "Only features that have a geometry that intersects the bounding box are selected. The bounding box is provided as four or six numbers, depending on whether the coordinate reference system includes a vertical axis (elevation or depth):\n \n* Lower left corner, coordinate axis 1\n* Lower left corner, coordinate axis 2\n* Lower left corner, coordinate axis 3 (optional)\n* Upper right corner, coordinate axis 1\n* Upper right corner, coordinate axis 2\n* Upper right corner, coordinate axis 3 (optional)\n\nThe coordinate reference system of the values is WGS84 longitude/latitude (http://www.opengis.net/def/crs/OGC/1.3/CRS84) unless a different coordinate reference system is specified in the parameter `bbox-crs`.\n\nFor WGS84 longitude/latitude the values are in most cases the sequence of minimum longitude, minimum latitude, maximum longitude and maximum latitude. However, in cases where the box spans the antimeridian the first value (west-most box edge) is larger 
 than the third value (east-most box edge).\n\nIf a feature has multiple spatial geometry properties, it is the decision of the server whether only a single spatial geometry property is used to determine the extent or all relevant geometries.",
-        "required" : false,
-        "style" : "form",
-        "explode" : false,
-        "schema" : {
-          "maxItems" : 6,
-          "minItems" : 4,
-          "type" : "array",
-          "items" : {
-            "type" : "number"
-          }
-        }
-      },
-      "time" : {
-        "name" : "time",
-        "in" : "query",
-        "description" : "Either a date-time or a period string that adheres to RFC 3339. Examples:\n\n* A date-time: \"2018-02-12T23:20:50Z\"\n* A period: \"2018-02-12T00:00:00Z/2018-03-18T12:31:12Z\" or \"2018-02-12T00:00:00Z/P1M6DT12H31M12S\"\n\nOnly features that have a temporal property that intersects the value of\n`time` are selected.\n\nIf a feature has multiple temporal properties, it is the decision of the\nserver whether only a single temporal property is used to determine\nthe extent or all relevant temporal properties.",
-        "required" : false,
-        "style" : "form",
-        "explode" : false,
-        "schema" : {
-          "type" : "string"
-        }
-      },
-      "resultType" : {
-        "name" : "resultType",
-        "in" : "query",
-        "description" : "This service will respond to a query in one of two ways (excluding an exception response). It may either generate a complete response document containing resources that satisfy the operation or it may simply generate an empty response container that indicates the count of the total number of resources that the operation would return. Which of these two responses is generated is determined by the value of the optional resultType parameter.\\\nThe allowed values for this parameter are \"results\" and \"hits\".\\\nIf the value of the resultType parameter is set to \"results\", the server will generate a complete response document containing resources that satisfy the operation.\\\nIf the value of the resultType attribute is set to \"hits\", the server will generate an empty response document containing no resource instances.\\\nDefault = \"results\".",
-        "required" : false,
-        "style" : "form",
-        "explode" : false,
-        "schema" : {
-          "type" : "string",
-          "enum" : [ "hits", "results" ],
-          "default" : "results"
-        },
-        "example" : "results"
-      },
-      "featureId" : {
-        "name" : "featureId",
-        "in" : "path",
-        "description" : "Local identifier of a specific feature",
-        "required" : true,
-        "schema" : {
-          "type" : "string"
-        }
-      },
-      "relations" : {
-        "name" : "relations",
-        "in" : "query",
-        "description" : "Comma-separated list of related collections that should be shown for this feature",
-        "required" : false,
-        "style" : "form",
-        "explode" : false,
-        "schema" : {
-          "type" : "array",
-          "items" : {
-            "type" : "string"
-          }
-        }
-      },
-      "resolve" : {
-        "name" : "resolve",
-        "in" : "query",
-        "description" : "Only provide links to related collections by default, resolve the links when true",
-        "required" : false,
-        "style" : "form",
-        "explode" : false,
-        "schema" : {
-          "type" : "boolean",
-          "default" : false
-        }
-      },
-      "limitList" : {
-        "name" : "limit",
-        "in" : "query",
-        "description" : "Comma-separated list of limits for related collections",
-        "required" : false,
-        "style" : "form",
-        "explode" : false,
-        "schema" : {
-          "type" : "array",
-          "items" : {
-            "maximum" : 10000,
-            "minimum" : 0,
-            "type" : "integer",
-            "format" : "int32",
-            "default" : 5
-          }
-        }
-      },
-      "offsetList" : {
-        "name" : "offset",
-        "in" : "query",
-        "description" : "Comma-separated list of offsets for related collections",
-        "required" : false,
-        "style" : "form",
-        "explode" : false,
-        "schema" : {
-          "type" : "array",
-          "items" : {
-            "minimum" : 0,
-            "type" : "integer",
-            "format" : "int32",
-            "default" : 0
-          }
-        }
-      },
-      "properties" : {
-        "name" : "properties",
-        "in" : "query",
-        "description" : "The properties that should be included for each feature. The parameter value is a comma-separated list of property names.",
-        "required" : false,
-        "style" : "form",
-        "explode" : false,
-        "schema" : {
-          "type" : "array",
-          "items" : {
-            "type" : "string"
-          }
-        }
-      },
-      "crs" : {
-        "name" : "crs",
-        "in" : "query",
-        "description" : "The coordinate reference system of the response geometries. Default is WGS84 longitude/latitude (http://www.opengis.net/def/crs/OGC/1.3/CRS84).",
-        "required" : false,
-        "style" : "form",
-        "explode" : false,
-        "schema" : {
-          "type" : "string",
-          "enum" : [ "http://www.opengis.net/def/crs/EPSG/0/25832", "http://www.opengis.net/def/crs/OGC/1.3/CRS84", "http://www.opengis.net/def/crs/EPSG/0/3034", "http://www.opengis.net/def/crs/EPSG/0/3035", "http://www.opengis.net/def/crs/EPSG/0/3043", "http://www.opengis.net/def/crs/EPSG/0/3044", "http://www.opengis.net/def/crs/EPSG/0/3045", "http://www.opengis.net/def/crs/EPSG/0/3857", "http://www.opengis.net/def/crs/EPSG/0/4258", "http://www.opengis.net/def/crs/EPSG/0/4326", "http://www.opengis.net/def/crs/EPSG/0/4647", "http://www.opengis.net/def/crs/EPSG/0/5649", "http://www.opengis.net/def/crs/EPSG/0/5650", "http://www.opengis.net/def/crs/EPSG/0/5651", "http://www.opengis.net/def/crs/EPSG/0/5652", "http://www.opengis.net/def/crs/EPSG/0/5653", "http://www.opengis.net/def/crs/EPSG/0/28992", "http://www.opengis.net/def/crs/EPSG/0/25831", "http://www.opengis.net/def/crs/EPSG/0/25833" ],
-          "default" : "http://www.opengis.net/def/crs/OGC/1.3/CRS84"
-        }
-      },
-      "bbox-crs" : {
-        "name" : "bbox-crs",
-        "in" : "query",
-        "description" : "The coordinate reference system of the bbox parameter. Default is WGS84 longitude/latitude (http://www.opengis.net/def/crs/OGC/1.3/CRS84).",
-        "required" : false,
-        "style" : "form",
-        "explode" : false,
-        "schema" : {
-          "type" : "string",
-          "enum" : [ "http://www.opengis.net/def/crs/EPSG/0/25832", "http://www.opengis.net/def/crs/OGC/1.3/CRS84", "http://www.opengis.net/def/crs/EPSG/0/3034", "http://www.opengis.net/def/crs/EPSG/0/3035", "http://www.opengis.net/def/crs/EPSG/0/3043", "http://www.opengis.net/def/crs/EPSG/0/3044", "http://www.opengis.net/def/crs/EPSG/0/3045", "http://www.opengis.net/def/crs/EPSG/0/3857", "http://www.opengis.net/def/crs/EPSG/0/4258", "http://www.opengis.net/def/crs/EPSG/0/4326", "http://www.opengis.net/def/crs/EPSG/0/4647", "http://www.opengis.net/def/crs/EPSG/0/5649", "http://www.opengis.net/def/crs/EPSG/0/5650", "http://www.opengis.net/def/crs/EPSG/0/5651", "http://www.opengis.net/def/crs/EPSG/0/5652", "http://www.opengis.net/def/crs/EPSG/0/5653", "http://www.opengis.net/def/crs/EPSG/0/28992", "http://www.opengis.net/def/crs/EPSG/0/25831", "http://www.opengis.net/def/crs/EPSG/0/25833" ],
-          "default" : "http://www.opengis.net/def/crs/OGC/1.3/CRS84"
-        }
-      },
-      "maxAllowableOffset" : {
-        "name" : "maxAllowableOffset",
-        "in" : "query",
-        "description" : "This option can be used to specify the maxAllowableOffset to be used for generalizing the response geometries.\n \nThe maxAllowableOffset is in the units of the response coordinate reference system.",
-        "required" : false,
-        "style" : "form",
-        "explode" : false,
-        "schema" : {
-          "type" : "number",
-          "default" : 0
-        },
-        "example" : 0.05
-      }
-    }
-  }
-}
-JSON;
-$jsonTemplate = json_decode($iaEampleJson);
-$apiDescriptionJson->components = $jsonTemplate;*/
+
+$jsonTemplate = json_decode(getOpenApi3JsonComponentTemplate());
+
+$apiDescriptionJson->components = $jsonTemplate->components;
+/*
 		//components
 		$apiDescriptionJson->components->schemas->exception->required[0] = "code";
 		$apiDescriptionJson->components->schemas->exception->type = "object";
@@ -1218,7 +1181,7 @@
 		$apiDescriptionJson->components->schemas->link->properties->type->hreflang = "string";
 		$apiDescriptionJson->components->schemas->link->properties->type->hreflang = "de";
 		
-		
+*/		
 /*
 		$apiDescriptionJson->components->schemas->content->
 		$apiDescriptionJson->components->schemas->collectionInfo->
@@ -1234,34 +1197,6 @@
 		die();
 
 	    }
-            //************************************************************************************************************************************
-            //service only part 
-            //************************************************************************************************************************************
-	    //add from rlp!
-	    $returnObject->id = $wfsid;
-            $returnObject->title = $wfs->title;
-	    $returnObject->description = $wfs->summary;
-	    $returnObject->provider = $wfs->providerName;
-	    $returnObject->providerEmail = $wfs->electronicMailAddress;
-	    //$returnObject->providerHomepage = $wfs->homepage; //TODO add to ows class!
-            $returnObject->providerHomepage = "http://www.geoportal.rlp.de/";
-	    $returnObject->license = $wfs->fees;
-
-	    //get contraints
-	    $constraints = new OwsConstraints();
-	    $constraints->languageCode = "de";
-	    $constraints->asTable = true;
-	    $constraints->id = $wfsid;
-	    $constraints->type = "wfs";
-	    $constraints->returnDirect = false;
-	    $tou = $constraints->getDisclaimer();//TODO encoding problems may occur!
-	    if (isset($imagePathReplace)) {
-		$tou = str_replace("../img/", $imagePathReplace, $tou);
-	    }
-	    if ($f == "html") {
-		$returnObject->license = $tou; //- generate license info in json for json format!!!!!
-	    }
-	    $returnObject->accessUrl = $wfs->getCapabilities;
 	    //
 	    $returnObject->links = array();
 	    $returnObject->crs = array();
@@ -1991,7 +1926,7 @@
 	$js1 .= "	    ";//function myFunction(item) { var element = document.getElementById(item);element.classList.toggle(\'show\');";
 	$js1 .= "	}";
 
-	$js1 .= "	function URL_add_parameter(url, param, value){"."\n";
+	$js1 .= "	function URL_add_parameter(url, param, value){"." ";
 	$js1 .= "	    var hash       = {};";
 	$js1 .= "	    var parser     = document.createElement('a');";
 	$js1 .= "	    parser.href    = url;";
@@ -2049,7 +1984,7 @@
 	//$js2 .= 'document.getElementById("bboxButtons").style.display = "none"; ';
 }
 $js2 .= $newline.'</script>'.$newline;
-	$newline = "\n";
+	$newline = " ";
 	//define header and navigation bar
 	$html = '';
 	$html .= '<!DOCTYPE html>'.$newline;
@@ -2202,7 +2137,7 @@
                 $html .= '        <div class="row my-3">'.$newline;
                 $html .= '            <div class="col-md-2 font-weight-bold">API Definition</div>'.$newline;
                 $html .= '            <div class="col-md-10">'.$newline;
-                $html .= '                <a href="https://www.geoportal.rlp.de/registry/wfs/1/collection/1/api?f=html">TODO!</a>'.$newline;
+                $html .= '                <a href="'.get2Rest($_SERVER['REQUEST_URI']."&collections=api").'">'.get2Rest($_SERVER['REQUEST_URI']."&collections=api").'</a>'.$newline;
                 $html .= '            </div>'.$newline;
                 $html .= '        </div>'.$newline;
 //further information about the service DATASOURCE TODO



More information about the Mapbender_commits mailing list