comparison 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
comparison
equal deleted inserted replaced
4610:1b928c0a0894 4611:b5aa1eb83bb0
29 29
30 type IntEntry struct { 30 type IntEntry struct {
31 Schema string `json:"schema"` 31 Schema string `json:"schema"`
32 Name string `json:"name"` 32 Name string `json:"name"`
33 SQL *string `json:"sql"` 33 SQL *string `json:"sql"`
34 SRS *string `json:"srs"`
34 Style bool `json:"style"` 35 Style bool `json:"style"`
35 WMS bool `json:"wms"` 36 WMS bool `json:"wms"`
36 WFS bool `json:"wfs"` 37 WFS bool `json:"wfs"`
37 } 38 }
38 39
41 mu sync.Mutex 42 mu sync.Mutex
42 } 43 }
43 44
44 const ( 45 const (
45 selectServicesSQL = ` 46 selectServicesSQL = `
46 SELECT schema, name, view_def, style IS NOT NULL, as_wms, as_wfs 47 SELECT schema, name,
48 view_def, auth_name || ':' || auth_srid,
49 style IS NOT NULL, as_wms, as_wfs
47 FROM sys_admin.published_services 50 FROM sys_admin.published_services
51 LEFT JOIN spatial_ref_sys USING (srid)
48 WHERE schema = $1 52 WHERE schema = $1
49 ORDER by name` 53 ORDER by name`
50 54
51 selectStyleSQL = ` 55 selectStyleSQL = `
52 SELECT XMLSERIALIZE(DOCUMENT style AS text) 56 SELECT XMLSERIALIZE(DOCUMENT style AS text)
135 defer rows.Close() 139 defer rows.Close()
136 for rows.Next() { 140 for rows.Next() {
137 var entry IntEntry 141 var entry IntEntry
138 if err := rows.Scan( 142 if err := rows.Scan(
139 &entry.Schema, &entry.Name, 143 &entry.Schema, &entry.Name,
140 &entry.SQL, &entry.Style, 144 &entry.SQL, &entry.SRS, &entry.Style,
141 &entry.WMS, &entry.WFS, 145 &entry.WMS, &entry.WFS,
142 ); err != nil { 146 ); err != nil {
143 return err 147 return err
144 } 148 }
145 ps.entries = append(ps.entries, entry) 149 ps.entries = append(ps.entries, entry)