changeset 4995:4a816ecf70de wmst-config

Added support for WMS-Time in configuring the GeoServer.
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Fri, 06 Mar 2020 11:48:11 +0100
parents 6a48e5c6fe2f
children 5aaeb1ba7e21
files pkg/geoserver/boot.go pkg/models/intservices.go schema/gemma.sql schema/updates/1410/01.wmst_attributes.sql schema/version.sql
diffstat 5 files changed, 32 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/pkg/geoserver/boot.go	Fri Mar 06 11:06:27 2020 +0100
+++ b/pkg/geoserver/boot.go	Fri Mar 06 11:48:11 2020 +0100
@@ -327,23 +327,23 @@
 			entries = append(entries, entry)
 		}
 
-		/* XXX: Experimental
-		if table == "sounding_differences" {
+		if attr := tables[i].WMSTAttribute; attr != nil {
 			di := map[string]interface{}{
 				"enabled":             true,
-				"attribute":           "minuend",
-				"endAttribute":        "subtrahend",
+				"attribute":           *attr,
 				"presentation":        "CONTINUOUS_INTERVAL",
 				"units":               "ISO8601",
 				"nearestMatchEnabled": false,
 			}
+			if endAttr := tables[i].WMSTEndAttribute; endAttr != nil {
+				di["endAttribute"] = *endAttr
+			}
 			entry := map[string]interface{}{
 				"@key":          "time",
 				"dimensionInfo": di,
 			}
 			entries = append(entries, entry)
 		}
-		*/
 
 		if len(entries) > 0 {
 			ft["metadata"] = map[string]interface{}{
--- a/pkg/models/intservices.go	Fri Mar 06 11:06:27 2020 +0100
+++ b/pkg/models/intservices.go	Fri Mar 06 11:48:11 2020 +0100
@@ -29,14 +29,16 @@
 
 type (
 	IntEntry struct {
-		Schema    string  `json:"schema"`
-		Name      string  `json:"name"`
-		SQL       *string `json:"sql"`
-		KeyColumn *string `json:"keycolumn"`
-		SRS       *string `json:"srs"`
-		Style     bool    `json:"style"`
-		WMS       bool    `json:"wms"`
-		WFS       bool    `json:"wfs"`
+		Schema           string  `json:"schema"`
+		Name             string  `json:"name"`
+		SQL              *string `json:"sql"`
+		KeyColumn        *string `json:"keycolumn"`
+		SRS              *string `json:"srs"`
+		Style            bool    `json:"style"`
+		WMS              bool    `json:"wms"`
+		WFS              bool    `json:"wfs"`
+		WMSTAttribute    *string `json:"wmst-attribute"`
+		WMSTEndAttribute *string `json:"wmst-end-attribute"`
 	}
 
 	LayerGroup struct {
@@ -53,9 +55,17 @@
 
 const (
 	selectServicesSQL = `
-SELECT schema, name,
-  view_def, key_column, auth_name || ':' || auth_srid,
-  style IS NOT NULL, as_wms, as_wfs
+SELECT
+  schema,
+  name,
+  view_def,
+  key_column,
+  auth_name || ':' || auth_srid,
+  style IS NOT NULL,
+  as_wms,
+  as_wfs,
+  wmst_attribute,
+  wmst_end_attribute
 FROM sys_admin.published_services
   LEFT JOIN spatial_ref_sys USING (srid)
 WHERE schema = $1
@@ -181,6 +191,7 @@
 				&entry.Schema, &entry.Name,
 				&entry.SQL, &entry.KeyColumn, &entry.SRS, &entry.Style,
 				&entry.WMS, &entry.WFS,
+				&entry.WMSTAttribute, &entry.WMSTEndAttribute,
 			); err != nil {
 				return err
 			}
--- a/schema/gemma.sql	Fri Mar 06 11:06:27 2020 +0100
+++ b/schema/gemma.sql	Fri Mar 06 11:48:11 2020 +0100
@@ -409,6 +409,8 @@
         style bytea,
         as_wms boolean NOT NULL DEFAULT TRUE,
         as_wfs boolean NOT NULL DEFAULT TRUE,
+        wmst_attribute     varchar DEFAULT NULL,
+        wmst_end_attribute varchar DEFAULT NULL,
         -- Either give a valid relation or a SQL statement:
         CHECK (to_regclass(schema || '.' || name) IS NOT NULL
             OR view_def IS NOT NULL)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/schema/updates/1410/01.wmst_attributes.sql	Fri Mar 06 11:48:11 2020 +0100
@@ -0,0 +1,2 @@
+ALTER TABLE sys_admin.published_services ADD COLUMN wmst_attribute     varchar DEFAULT NULL;
+ALTER TABLE sys_admin.published_services ADD COLUMN wmst_end_attribute varchar DEFAULT NULL;
--- a/schema/version.sql	Fri Mar 06 11:06:27 2020 +0100
+++ b/schema/version.sql	Fri Mar 06 11:48:11 2020 +0100
@@ -1,1 +1,1 @@
-INSERT INTO gemma_schema_version(version) VALUES (1409);
+INSERT INTO gemma_schema_version(version) VALUES (1410);