Skip to content

Commit c1ffb5d

Browse files
Merge pull request #68 from PDOK/jd/wms-prefix
Prefix in WMS spec
2 parents b662e35 + c32fe7e commit c1ffb5d

File tree

14 files changed

+25
-20
lines changed

14 files changed

+25
-20
lines changed

api/v2beta1/wms_conversion.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ func (src *WMS) ToV3(target *pdoknlv3.WMS) {
7777
dst.Spec.HealthCheck = convertHealthCheckToV3(src.Spec.Kubernetes.HealthCheck)
7878

7979
service := pdoknlv3.WMSService{
80+
Prefix: src.Spec.General.Dataset,
8081
URL: CreateBaseURL("https://service.pdok.nl", "wms", src.Spec.General),
8182
OwnerInfoRef: "pdok",
8283
Title: src.Spec.Service.Title,

api/v3/wms_types.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,9 @@ type WMSSpec struct {
7474
}
7575

7676
type WMSService struct {
77+
// +kubebuilder:validation:MinLength:=1
78+
Prefix string `json:"prefix"`
79+
7780
// URL of the service
7881
// +kubebuilder:validation:Format:=uri
7982
URL string `json:"url"`

config/crd/bases/pdok.nl_wms.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2095,6 +2095,9 @@ spec:
20952095
description: Reference to a CR of Kind OwnerInfo
20962096
minLength: 1
20972097
type: string
2098+
prefix:
2099+
minLength: 1
2100+
type: string
20982101
resolution:
20992102
description: 'Mapfile setting: Sets the RESOLUTION field in the mapfile, not used when service.mapfile is configured'
21002103
format: int32
@@ -2137,6 +2140,7 @@ spec:
21372140
- keywords
21382141
- layer
21392142
- ownerInfoRef
2143+
- prefix
21402144
- title
21412145
- url
21422146
type: object

internal/controller/mapfilegenerator/mapper.go

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package mapfilegenerator
22

33
import (
4-
"fmt"
54
"strconv"
65
"strings"
76

@@ -145,22 +144,15 @@ func getGeopackagePath(data pdoknlv3.Data) *string {
145144
return smoothoperatorutils.Pointer(geopackagePath + "/" + blobName)
146145
}
147146

148-
func MapWMSToMapfileGeneratorInput(wms *pdoknlv3.WMS, _ *smoothoperatorv1.OwnerInfo) (WMSInput, error) {
147+
func MapWMSToMapfileGeneratorInput(wms *pdoknlv3.WMS, ownerInfo *smoothoperatorv1.OwnerInfo) (WMSInput, error) {
149148
service := wms.Spec.Service
150149

151-
datasetOwner := ""
152-
if service.Layer.Authority != nil {
153-
datasetOwner = service.Layer.Authority.Name
154-
} else {
155-
datasetOwner = wms.ObjectMeta.Labels["dataset-owner"]
156-
}
157-
158-
datasetName := wms.ObjectMeta.Labels["dataset"]
159-
protocol := "http"
160150
authority := wms.GetAuthority()
161151
authorityURL := ""
152+
datasetOwner := ""
162153
if authority != nil {
163154
authorityURL = authority.URL
155+
datasetOwner = authority.Name
164156
}
165157

166158
box := service.GetBoundingBox()
@@ -198,8 +190,8 @@ func MapWMSToMapfileGeneratorInput(wms *pdoknlv3.WMS, _ *smoothoperatorv1.OwnerI
198190
Abstract: service.Abstract,
199191
Keywords: strings.Join(wms.Spec.Service.KeywordsIncludingInspireKeyword(), ","),
200192
Extent: extent,
201-
NamespacePrefix: datasetName,
202-
NamespaceURI: fmt.Sprintf("%s://%s.geonovum.nl", protocol, datasetName),
193+
NamespacePrefix: wms.Spec.Service.Prefix,
194+
NamespaceURI: mapperutils.GetNamespaceURI(wms.Spec.Service.Prefix, ownerInfo),
203195
OnlineResource: pdoknlv3.GetHost(true),
204196
Path: "/" + pdoknlv3.GetBaseURLPath(wms),
205197
MetadataID: metadataID,

internal/controller/test_data/wms/complete/input/wms.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ spec:
4444
ephemeral-storage: 11G
4545
memory: 50M
4646
service:
47+
prefix: dataset
4748
abstract: some "service" abstract
4849
accessConstraints: http://creativecommons.org/publicdomain/zero/1.0/deed.nl
4950
dataEPSG: EPSG:28992

internal/controller/test_data/wms/custom-mapfile/expected/configmap-mapfile-generator.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ metadata:
107107
inspire: "false"
108108
service-type: wms
109109
service-version: v1_0
110-
name: custom-mapfile-wms-mapfile-generator-gbcm54mbtm
110+
name: custom-mapfile-wms-mapfile-generator-kg99hgf8dg
111111
namespace: default
112112
ownerReferences:
113113
- apiVersion: pdok.nl/v3

internal/controller/test_data/wms/custom-mapfile/input/wms.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ spec:
1919
limits:
2020
ephemeral-storage: 100m
2121
service:
22+
prefix: dataset
2223
abstract: service-abstract
2324
accessConstraints: http://creativecommons.org/publicdomain/zero/1.0/deed.nl
2425
dataEPSG: EPSG:28992

internal/controller/test_data/wms/minimal/expected/configmap-mapfile-generator.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ metadata:
107107
inspire: "false"
108108
service-type: wms
109109
service-version: v1_0
110-
name: minimal-wms-mapfile-generator-gbcm54mbtm
110+
name: minimal-wms-mapfile-generator-kg99hgf8dg
111111
namespace: default
112112
ownerReferences:
113113
- apiVersion: pdok.nl/v3

internal/controller/test_data/wms/minimal/expected/deployment.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ spec:
346346
defaultMode: 420
347347
name: capabilities-generator-config
348348
- configMap:
349-
name: minimal-wms-mapfile-generator-gbcm54mbtm
349+
name: minimal-wms-mapfile-generator-kg99hgf8dg
350350
defaultMode: 420
351351
name: mapfile-generator-config
352352
- name: styling-files

internal/controller/test_data/wms/minimal/input/wms.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ spec:
1919
limits:
2020
ephemeral-storage: 100m
2121
service:
22+
prefix: dataset
2223
abstract: service-abstract
2324
accessConstraints: http://creativecommons.org/publicdomain/zero/1.0/deed.nl
2425
dataEPSG: EPSG:28992

0 commit comments

Comments
 (0)