Skip to content

Commit 255d262

Browse files
committed
Added bounding box on toplayer in case of non-RD CRS.
1 parent b652119 commit 255d262

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

api/v2beta1/wms_conversion.go

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,10 @@ package v2beta1
2626

2727
import (
2828
"errors"
29+
sharedModel "github.com/pdok/smooth-operator/model"
2930
"log"
3031
"strconv"
3132

32-
sharedModel "github.com/pdok/smooth-operator/model"
33-
3433
"sigs.k8s.io/controller-runtime/pkg/conversion"
3534

3635
pdoknlv3 "github.com/pdok/mapserver-operator/api/v3"
@@ -300,6 +299,13 @@ func (v2Service WMSService) MapLayersToV3() pdoknlv3.Layer {
300299
Layers: &[]pdoknlv3.Layer{},
301300
}
302301

302+
if v2Service.DataEPSG != "EPSG:28992" && v2Service.Extent != nil {
303+
layer.BoundingBoxes = append(layer.BoundingBoxes, pdoknlv3.WMSBoundingBox{
304+
CRS: v2Service.DataEPSG,
305+
BBox: sharedModel.ExtentToBBox(*v2Service.Extent),
306+
})
307+
}
308+
303309
var childLayersV3 []pdoknlv3.Layer
304310
for _, childLayer := range v2Service.Layers {
305311
childLayersV3 = append(childLayersV3, childLayer.MapToV3(v2Service))
@@ -355,6 +361,10 @@ func (v2Layer WMSLayer) MapToV3(v2Service WMSService) pdoknlv3.Layer {
355361
})
356362
}
357363

364+
if len(layer.BoundingBoxes) == 0 && v2Service.DataEPSG != "EPSG:28992" {
365+
print("Broken!")
366+
}
367+
358368
if v2Layer.MinScale != nil {
359369
layer.MinScaleDenominator = Pointer(strconv.FormatFloat(*v2Layer.MinScale, 'f', -1, 64))
360370
}

0 commit comments

Comments
 (0)