diff pkg/models/intservices.go @ 4611:b5aa1eb83bb0 geoserver_sql_views

Add possibility to configure SRS for GeoServer SQL view Automatic detection of spatial reference system for SQL views in GeoServer does not always find the correct SRS.
author Tom Gottfried <tom@intevation.de>
date Fri, 06 Sep 2019 11:58:03 +0200
parents dfe9cde6a20c
children 443867b548b5
line wrap: on
line diff
--- a/pkg/models/intservices.go	Thu Sep 05 17:41:43 2019 +0200
+++ b/pkg/models/intservices.go	Fri Sep 06 11:58:03 2019 +0200
@@ -31,6 +31,7 @@
 	Schema string  `json:"schema"`
 	Name   string  `json:"name"`
 	SQL    *string `json:"sql"`
+	SRS    *string `json:"srs"`
 	Style  bool    `json:"style"`
 	WMS    bool    `json:"wms"`
 	WFS    bool    `json:"wfs"`
@@ -43,8 +44,11 @@
 
 const (
 	selectServicesSQL = `
-SELECT schema, name, view_def, style IS NOT NULL, as_wms, as_wfs
+SELECT schema, name,
+  view_def, auth_name || ':' || auth_srid,
+  style IS NOT NULL, as_wms, as_wfs
 FROM sys_admin.published_services
+  LEFT JOIN spatial_ref_sys USING (srid)
 WHERE schema = $1
 ORDER by name`
 
@@ -137,7 +141,7 @@
 				var entry IntEntry
 				if err := rows.Scan(
 					&entry.Schema, &entry.Name,
-					&entry.SQL, &entry.Style,
+					&entry.SQL, &entry.SRS, &entry.Style,
 					&entry.WMS, &entry.WFS,
 				); err != nil {
 					return err