Skip to content

Commit 5b2e3f7

Browse files
authored
Merge pull request #119 from PDOK/oversampleratio-add
Added oversample ratio to tiff layer
2 parents 9c7ea0a + ab07839 commit 5b2e3f7

File tree

7 files changed

+62
-18
lines changed

7 files changed

+62
-18
lines changed

api/v3/shared_types.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,12 @@ type TIF struct {
251251
// +kubebuilder:default=NEAREST
252252
Resample string `json:"resample,omitempty"`
253253

254+
// Controls the smoothing of the image on a certain point. Bigger value gives a smoother/better picture but
255+
// results in slower web responses, optional
256+
// +kubebuilder:validation:Pattern="^-?[0-9]+([.][0-9]*)?$"
257+
// +kubebuilder:default="2.5"
258+
OversampleRatio string `json:"oversampleRatio,omitempty"`
259+
254260
// Sets the color index to treat as transparent for raster layers, optional, hex or rgb
255261
// +kubebuilder:validation:Pattern=`(#[0-9A-F]{6}([0-9A-F]{2})?)|([0-9]{1,3}\s[0-9]{1,3}\s[0-9]{1,3})`
256262
Offsite *string `json:"offsite,omitempty"`

config/crd/bases/pdok.nl_wms.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1070,6 +1070,13 @@ spec:
10701070
description: Sets the color index to treat as transparent for raster layers, optional, hex or rgb
10711071
pattern: (#[0-9A-F]{6}([0-9A-F]{2})?)|([0-9]{1,3}\s[0-9]{1,3}\s[0-9]{1,3})
10721072
type: string
1073+
oversampleRatio:
1074+
default: "2.5"
1075+
description: |-
1076+
Controls the smoothing of the image on a certain point. Bigger value gives a smoother/better picture but
1077+
results in slower web responses, optional
1078+
pattern: ^-?[0-9]+([.][0-9]*)?$
1079+
type: string
10731080
resample:
10741081
default: NEAREST
10751082
description: This option can be used to control the resampling kernel used sampling raster images, optional
@@ -1275,6 +1282,13 @@ spec:
12751282
description: Sets the color index to treat as transparent for raster layers, optional, hex or rgb
12761283
pattern: (#[0-9A-F]{6}([0-9A-F]{2})?)|([0-9]{1,3}\s[0-9]{1,3}\s[0-9]{1,3})
12771284
type: string
1285+
oversampleRatio:
1286+
default: "2.5"
1287+
description: |-
1288+
Controls the smoothing of the image on a certain point. Bigger value gives a smoother/better picture but
1289+
results in slower web responses, optional
1290+
pattern: ^-?[0-9]+([.][0-9]*)?$
1291+
type: string
12781292
resample:
12791293
default: NEAREST
12801294
description: This option can be used to control the resampling kernel used sampling raster images, optional

internal/controller/mapfilegenerator/test_data/expected/wms_tif.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
"name": "luchtfotoroads_100pixkm",
3939
"offsite": "#978E97",
4040
"resample": "BILINEAR",
41+
"oversample_ratio": "1",
4142
"styles": [
4243
{
4344
"path": "/styling/roads.style",
@@ -61,6 +62,7 @@
6162
"name": "luchtfotoroads_200pixkm",
6263
"offsite": "#978E97",
6364
"resample": "BILINEAR",
65+
"oversample_ratio": "2.0",
6466
"styles": [
6567
{
6668
"path": "/styling/roads.style",
@@ -84,6 +86,7 @@
8486
"name": "luchtfotoroads_400pixkm",
8587
"offsite": "#978E97",
8688
"resample": "BILINEAR",
89+
"oversample_ratio": "2.5",
8790
"styles": [
8891
{
8992
"path": "/styling/roads.style",
@@ -107,6 +110,7 @@
107110
"name": "luchtfotoroads_800pixkm",
108111
"offsite": "#978E97",
109112
"resample": "BILINEAR",
113+
"oversample_ratio": "1",
110114
"styles": [
111115
{
112116
"path": "/styling/roads.style",
@@ -130,6 +134,7 @@
130134
"name": "luchtfotoroads_1600pixkm",
131135
"offsite": "#978E97",
132136
"resample": "BILINEAR",
137+
"oversample_ratio": "1",
133138
"styles": [
134139
{
135140
"path": "/styling/roads.style",
@@ -153,6 +158,7 @@
153158
"name": "luchtfotolabels_100pixkm",
154159
"offsite": "#978E97",
155160
"resample": "BILINEAR",
161+
"oversample_ratio": "1",
156162
"styles": [
157163
{
158164
"path": "/styling/labels.style",
@@ -176,6 +182,7 @@
176182
"name": "luchtfotolabels_200pixkm",
177183
"offsite": "#978E97",
178184
"resample": "BILINEAR",
185+
"oversample_ratio": "1",
179186
"styles": [
180187
{
181188
"path": "/styling/labels.style",
@@ -199,6 +206,7 @@
199206
"name": "luchtfotolabels_400pixkm",
200207
"offsite": "#978E97",
201208
"resample": "BILINEAR",
209+
"oversample_ratio": "1",
202210
"styles": [
203211
{
204212
"path": "/styling/labels.style",
@@ -222,6 +230,7 @@
222230
"name": "luchtfotolabels_800pixkm",
223231
"offsite": "#978E97",
224232
"resample": "BILINEAR",
233+
"oversample_ratio": "1",
225234
"styles": [
226235
{
227236
"path": "/styling/labels.style",
@@ -245,6 +254,7 @@
245254
"name": "luchtfotolabels_1600pixkm",
246255
"offsite": "#978E97",
247256
"resample": "BILINEAR",
257+
"oversample_ratio": "1",
248258
"styles": [
249259
{
250260
"path": "/styling/labels.style",
@@ -267,6 +277,7 @@
267277
"name": "luchtfotolabels_3200pixkm",
268278
"offsite": "#978E97",
269279
"resample": "BILINEAR",
280+
"oversample_ratio": "1",
270281
"styles": [
271282
{
272283
"path": "/styling/labels.style",

internal/controller/mapfilegenerator/test_data/input/wms_tif.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ spec:
133133
blobKey: tifs/bzk/luchtfotolabels/${GPKG_VERSION}/100pixkm_luforoads/100pixkm_luforoads.vrt
134134
offsite: '#978E97'
135135
resample: BILINEAR
136+
oversampleRatio: "1"
136137
datasetMetadataUrl:
137138
csw:
138139
metadataIdentifier: 6ca22f53-b072-42f4-b920-104c7c83cd28
@@ -159,6 +160,7 @@ spec:
159160
blobKey: tifs/bzk/luchtfotolabels/${GPKG_VERSION}/200pixkm_luforoads/200pixkm_luforoads.vrt
160161
offsite: '#978E97'
161162
resample: BILINEAR
163+
oversampleRatio: "2.0"
162164
datasetMetadataUrl:
163165
csw:
164166
metadataIdentifier: 6ca22f53-b072-42f4-b920-104c7c83cd28
@@ -185,6 +187,7 @@ spec:
185187
blobKey: tifs/bzk/luchtfotolabels/${GPKG_VERSION}/400pixkm_luforoads/400pixkm_luforoads.vrt
186188
offsite: '#978E97'
187189
resample: BILINEAR
190+
oversampleRatio: "2.5"
188191
datasetMetadataUrl:
189192
csw:
190193
metadataIdentifier: 6ca22f53-b072-42f4-b920-104c7c83cd28
@@ -211,6 +214,7 @@ spec:
211214
blobKey: tifs/bzk/luchtfotolabels/${GPKG_VERSION}/800pixkm_luforoads/800pixkm_luforoads.vrt
212215
offsite: '#978E97'
213216
resample: BILINEAR
217+
oversampleRatio: "1"
214218
datasetMetadataUrl:
215219
csw:
216220
metadataIdentifier: 6ca22f53-b072-42f4-b920-104c7c83cd28
@@ -237,6 +241,7 @@ spec:
237241
blobKey: tifs/bzk/luchtfotolabels/${GPKG_VERSION}/1600pixkm_luforoads/1600pixkm_luforoads.vrt
238242
offsite: '#978E97'
239243
resample: BILINEAR
244+
oversampleRatio: "1"
240245
datasetMetadataUrl:
241246
csw:
242247
metadataIdentifier: 6ca22f53-b072-42f4-b920-104c7c83cd28
@@ -263,6 +268,7 @@ spec:
263268
blobKey: tifs/bzk/luchtfotolabels/${GPKG_VERSION}/100pixkm_lufolabels/100pixkm_lufolabels.vrt
264269
offsite: '#978E97'
265270
resample: BILINEAR
271+
oversampleRatio: "1"
266272
datasetMetadataUrl:
267273
csw:
268274
metadataIdentifier: 6ca22f53-b072-42f4-b920-104c7c83cd28
@@ -289,6 +295,7 @@ spec:
289295
blobKey: tifs/bzk/luchtfotolabels/${GPKG_VERSION}/200pixkm_lufolabels/200pixkm_lufolabels.vrt
290296
offsite: '#978E97'
291297
resample: BILINEAR
298+
oversampleRatio: "1"
292299
datasetMetadataUrl:
293300
csw:
294301
metadataIdentifier: 6ca22f53-b072-42f4-b920-104c7c83cd28
@@ -315,6 +322,7 @@ spec:
315322
blobKey: tifs/bzk/luchtfotolabels/${GPKG_VERSION}/400pixkm_lufolabels/400pixkm_lufolabels.vrt
316323
offsite: '#978E97'
317324
resample: BILINEAR
325+
oversampleRatio: "1"
318326
datasetMetadataUrl:
319327
csw:
320328
metadataIdentifier: 6ca22f53-b072-42f4-b920-104c7c83cd28
@@ -341,6 +349,7 @@ spec:
341349
blobKey: tifs/bzk/luchtfotolabels/${GPKG_VERSION}/800pixkm_lufolabels/800pixkm_lufolabels.vrt
342350
offsite: '#978E97'
343351
resample: BILINEAR
352+
oversampleRatio: "1"
344353
datasetMetadataUrl:
345354
csw:
346355
metadataIdentifier: 6ca22f53-b072-42f4-b920-104c7c83cd28
@@ -367,6 +376,7 @@ spec:
367376
blobKey: tifs/bzk/luchtfotolabels/${GPKG_VERSION}/1600pixkm_lufolabels/1600pixkm_lufolabels.vrt
368377
offsite: '#978E97'
369378
resample: BILINEAR
379+
oversampleRatio: "1"
370380
datasetMetadataUrl:
371381
csw:
372382
metadataIdentifier: 6ca22f53-b072-42f4-b920-104c7c83cd28
@@ -393,6 +403,7 @@ spec:
393403
blobKey: tifs/bzk/luchtfotolabels/${GPKG_VERSION}/3200pixkm_lufolabels/3200pixkm_lufolabels.vrt
394404
offsite: '#978E97'
395405
resample: BILINEAR
406+
oversampleRatio: "1"
396407
datasetMetadataUrl:
397408
csw:
398409
metadataIdentifier: 6ca22f53-b072-42f4-b920-104c7c83cd28

internal/controller/mapfilegenerator/types.go

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -53,22 +53,23 @@ type WMSInput struct {
5353

5454
//nolint:tagliatelle
5555
type BaseLayer struct {
56-
Name string `json:"name"`
57-
Title string `json:"title"`
58-
Abstract string `json:"abstract"`
59-
Keywords string `json:"keywords"`
60-
Extent string `json:"layer_extent"`
61-
MetadataID string `json:"dataset_metadata_id"`
62-
Columns []Column `json:"columns,omitempty"`
63-
GeometryType *string `json:"geometry_type,omitempty"`
64-
GeopackagePath *string `json:"gpkg_path,omitempty"`
65-
TableName *string `json:"tablename,omitempty"`
66-
Postgis *bool `json:"postgis,omitempty"`
67-
MinScale *string `json:"minscale,omitempty"`
68-
MaxScale *string `json:"maxscale,omitempty"`
69-
TifPath *string `json:"tif_path,omitempty"`
70-
Resample *string `json:"resample,omitempty"`
71-
LabelNoClip bool `json:"label_no_clip,omitempty"`
56+
Name string `json:"name"`
57+
Title string `json:"title"`
58+
Abstract string `json:"abstract"`
59+
Keywords string `json:"keywords"`
60+
Extent string `json:"layer_extent"`
61+
MetadataID string `json:"dataset_metadata_id"`
62+
Columns []Column `json:"columns,omitempty"`
63+
GeometryType *string `json:"geometry_type,omitempty"`
64+
GeopackagePath *string `json:"gpkg_path,omitempty"`
65+
TableName *string `json:"tablename,omitempty"`
66+
Postgis *bool `json:"postgis,omitempty"`
67+
MinScale *string `json:"minscale,omitempty"`
68+
MaxScale *string `json:"maxscale,omitempty"`
69+
TifPath *string `json:"tif_path,omitempty"`
70+
Resample *string `json:"resample,omitempty"`
71+
OversampleRatio *string `json:"oversample_ratio,omitempty"`
72+
LabelNoClip bool `json:"label_no_clip,omitempty"`
7273
}
7374

7475
type WFSLayer struct {
@@ -124,6 +125,7 @@ func SetDataFields[O pdoknlv3.WMSWFS](obj O, wmsLayer *WMSLayer, data pdoknlv3.D
124125
wmsLayer.BaseLayer.TifPath = smoothoperatorutils.Pointer(path.Join("/vsiaz", reReplace.ReplaceAllString(tif.BlobKey, "")))
125126
}
126127
wmsLayer.BaseLayer.Resample = &tif.Resample
128+
wmsLayer.BaseLayer.OversampleRatio = &tif.OversampleRatio
127129
wmsLayer.Offsite = smoothoperatorutils.PointerVal(tif.Offsite, "")
128130
wmsLayer.GetFeatureInfoIncludesClass = &tif.GetFeatureInfoIncludesClass
129131
case data.Postgis != nil:

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ metadata:
168168
service-type: wms
169169
service-version: v1_0
170170
theme: '2016'
171-
name: complete-wms-mapfile-generator-b4bbcf5kdk
171+
name: complete-wms-mapfile-generator-gh2fg6ccm9
172172
namespace: default
173173
ownerReferences:
174174
- apiVersion: pdok.nl/v3

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,7 @@ spec:
382382
defaultMode: 420
383383
name: capabilities-generator-config
384384
- configMap:
385-
name: complete-wms-mapfile-generator-b4bbcf5kdk
385+
name: complete-wms-mapfile-generator-gh2fg6ccm9
386386
defaultMode: 420
387387
name: mapfile-generator-config
388388
- name: styling-files

0 commit comments

Comments
 (0)