Skip to content

Commit d2d172e

Browse files
committed
Worked out TIF generation and changed some crd conversion things to accommodate it
1 parent 8efaec6 commit d2d172e

File tree

6 files changed

+35
-6
lines changed

6 files changed

+35
-6
lines changed

api/v2beta1/wms_conversion.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ func V3HubFromV2(src *WMS, target *pdoknlv3.WMS) {
111111
}
112112
}
113113

114-
if src.Spec.Service.Inspire {
114+
if src.Spec.Service.Inspire || true {
115115
service.Inspire = &pdoknlv3.Inspire{
116116
ServiceMetadataURL: pdoknlv3.MetadataURL{
117117
CSW: &pdoknlv3.Metadata{

api/v3/wms_types.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,8 +211,8 @@ func (wmsService *WMSService) GetBoundingBox() WMSBoundingBox {
211211
CRS: "EPSG:28992",
212212
BBox: shared_model.BBox{
213213
MinX: "-25000",
214-
MaxX: "250000",
215-
MinY: "280000",
214+
MaxX: "280000",
215+
MinY: "250000",
216216
MaxY: "860000",
217217
},
218218
}

internal/controller/mapfilegenerator/mapfile_generator_test.go

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

internal/controller/mapfilegenerator/mapper.go

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,13 @@ func MapWMSToMapfileGeneratorInput(wms *pdoknlv3.WMS, ownerInfo *smoothoperatorv
9797
accessConstraints = "https://creativecommons.org/publicdomain/zero/1.0/deed.nl"
9898
}
9999

100-
owner := wms.ObjectMeta.Labels["dataset-owner"]
100+
datasetOwner := ""
101+
if service.Layer.Authority != nil {
102+
datasetOwner = service.Layer.Authority.Name
103+
} else {
104+
datasetOwner = wms.ObjectMeta.Labels["dataset-owner"]
105+
}
106+
101107
datasetName := wms.ObjectMeta.Labels["dataset"]
102108
protocol := "http"
103109
authority := wms.GetAuthority()
@@ -121,6 +127,18 @@ func MapWMSToMapfileGeneratorInput(wms *pdoknlv3.WMS, ownerInfo *smoothoperatorv
121127
metadataId = service.Inspire.ServiceMetadataURL.CSW.MetadataIdentifier
122128
}
123129

130+
var fonts *string
131+
132+
if service.StylingAssets != nil {
133+
writeFonts := mapperutils.AnyMatch(service.StylingAssets.BlobKeys, func(s string) bool {
134+
return strings.HasSuffix(s, ".ttf")
135+
})
136+
137+
if writeFonts {
138+
fonts = smoothoperatorutils.Pointer("/srv/data/config/fonts")
139+
}
140+
}
141+
124142
result := WMSInput{
125143
BaseServiceInput: BaseServiceInput{
126144
Title: service.Title,
@@ -132,7 +150,7 @@ func MapWMSToMapfileGeneratorInput(wms *pdoknlv3.WMS, ownerInfo *smoothoperatorv
132150
OnlineResource: pdoknlv3.GetHost(),
133151
Path: mapperutils.GetPath(wms),
134152
MetadataId: metadataId,
135-
DatasetOwner: &owner,
153+
DatasetOwner: &datasetOwner,
136154
AuthorityURL: &authorityUrl,
137155
AutomaticCasing: wms.Spec.Options.AutomaticCasing,
138156
DataEPSG: service.DataEPSG,
@@ -142,6 +160,7 @@ func MapWMSToMapfileGeneratorInput(wms *pdoknlv3.WMS, ownerInfo *smoothoperatorv
142160
Layers: []WMSLayer{},
143161
GroupLayers: []GroupLayer{},
144162
Symbols: getSymbols(wms),
163+
Fonts: fonts,
145164
OutputFormatJpg: "jpg",
146165
OutputFormatPng: "png",
147166
Templates: "/srv/data/config/templates",

internal/controller/mapfilegenerator/types.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ type WMSInput struct {
3232
Layers []WMSLayer `json:"layers"`
3333
GroupLayers []GroupLayer `json:"group_layers"`
3434
Symbols []string `json:"symbols"`
35+
Fonts *string `json:"fonts"`
3536
Templates string `json:"templates,omitempty"`
3637
OutputFormatJpg string `json:"outputformat_jpg"`
3738
OutputFormatPng string `json:"outputformat_png8"`

internal/controller/mapperutils/utils.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,3 +78,12 @@ func GetLabelValueByKey(labels map[string]string, key string) *string {
7878
}
7979
return nil
8080
}
81+
82+
func AnyMatch[S ~[]E, E any](slice S, eql func(E) bool) bool {
83+
for _, elem := range slice {
84+
if eql(elem) {
85+
return true
86+
}
87+
}
88+
return false
89+
}

0 commit comments

Comments
 (0)