@@ -204,6 +204,8 @@ func mapServiceProvider(provider *smoothoperatorv1.ServiceProvider) (serviceProv
204204}
205205
206206func MapWMSToCapabilitiesGeneratorInput (wms * pdoknlv3.WMS , ownerInfo * smoothoperatorv1.OwnerInfo ) (* capabilitiesgenerator.Config , error ) {
207+ canonicalServiceUrl := "https://service.pdok.nl" + "/" + pdoknlv3 .GetBaseURLPath (wms )
208+
207209 abstract := mapperutils .EscapeQuotes (wms .Spec .Service .Abstract )
208210 var fees * string = nil
209211 if wms .Spec .Service .Fees != nil {
@@ -241,13 +243,22 @@ func MapWMSToCapabilitiesGeneratorInput(wms *pdoknlv3.WMS, ownerInfo *smoothoper
241243 Capabilities : wms130.Capabilities {
242244 WMSCapabilities : wms130.WMSCapabilities {
243245 Request : wms130.Request {
244- GetCapabilities : wms130.RequestType {},
245- GetMap : wms130.RequestType {},
246- GetFeatureInfo : nil ,
246+ GetCapabilities : wms130.RequestType {
247+ Format : []string {"text/xml" },
248+ DCPType : getDcpType (canonicalServiceUrl , false ),
249+ },
250+ GetMap : wms130.RequestType {
251+ Format : []string {"image/png" , "image/jpeg" , "image/png; mode=8bit" , "image/vnd.jpeg-png" , "image/vnd.jpeg-png8" },
252+ DCPType : getDcpType (canonicalServiceUrl , true ),
253+ },
254+ GetFeatureInfo : & wms130.RequestType {
255+ Format : []string {"application/json" , "application/json; subtype=geojson" , "application/vnd.ogc.gml" , "text/html" , "text/plain" , "text/xml" , "text/xml; subtype=gml/3.1.1" },
256+ DCPType : getDcpType (canonicalServiceUrl , true ),
257+ },
247258 },
248259 Exception : wms130.ExceptionType {Format : []string {"XML" , "BLANK" }},
249260 ExtendedCapabilities : nil ,
250- Layer : nil ,
261+ Layer : getLayers ( wms ) ,
251262 },
252263 OptionalConstraints : wms130.OptionalConstraints {},
253264 },
@@ -329,6 +340,189 @@ func getContactInformation(ownerInfo *smoothoperatorv1.OwnerInfo) *wms130.Contac
329340 return & result
330341}
331342
343+ func getDcpType (url string , fillPost bool ) * wms130.DCPType {
344+ get := wms130.Method {
345+ OnlineResource : wms130.OnlineResource {
346+ Xlink : nil ,
347+ Type : nil ,
348+ Href : asPtr (url ),
349+ },
350+ }
351+
352+ var post * wms130.Method = nil
353+ if fillPost {
354+ post = & get
355+ }
356+
357+ result := wms130.DCPType {
358+ HTTP : struct {
359+ Get wms130.Method `xml:"Get" yaml:"get"`
360+ Post * wms130.Method `xml:"Post" yaml:"post"`
361+ }{
362+ Get : get ,
363+ Post : post ,
364+ },
365+ }
366+ return & result
367+ }
368+
369+ func getLayers (wms * pdoknlv3.WMS ) []wms130.Layer {
370+ result := make ([]wms130.Layer , 0 )
371+ referenceLayer := wms .Spec .Service .Layer
372+ title := referenceLayer .Title
373+ if title != nil {
374+ title = asPtr (mapperutils .EscapeQuotes (* referenceLayer .Title ))
375+ } else {
376+ title = asPtr ("" )
377+ }
378+
379+ defaultCrs := []wms130.CRS {{
380+ Namespace : "EPSG" ,
381+ Code : 28992 ,
382+ }, {
383+ Namespace : "EPSG" ,
384+ Code : 25831 ,
385+ }, {
386+ Namespace : "EPSG" ,
387+ Code : 25832 ,
388+ }, {
389+ Namespace : "EPSG" ,
390+ Code : 3034 ,
391+ }, {
392+ Namespace : "EPSG" ,
393+ Code : 3035 ,
394+ }, {
395+ Namespace : "EPSG" ,
396+ Code : 3857 ,
397+ }, {
398+ Namespace : "EPSG" ,
399+ Code : 4258 ,
400+ }, {
401+ Namespace : "EPSG" ,
402+ Code : 4326 ,
403+ }, {
404+ Namespace : "CRS" ,
405+ Code : 84 ,
406+ }}
407+
408+ defaultBoundingBox := wms130.EXGeographicBoundingBox {
409+ WestBoundLongitude : 2.52713 ,
410+ EastBoundLongitude : 7.37403 ,
411+ SouthBoundLatitude : 50.2129 ,
412+ NorthBoundLatitude : 55.7212 ,
413+ }
414+
415+ allDefaultBoundingBoxes := make ([]* wms130.LayerBoundingBox , 0 )
416+ allDefaultBoundingBoxes = append (allDefaultBoundingBoxes ,
417+ & wms130.LayerBoundingBox {
418+ CRS : "EPSG:28992" ,
419+ Minx : - 25000 ,
420+ Miny : 250000 ,
421+ Maxx : 280000 ,
422+ Maxy : 860000 ,
423+ Resx : 0 ,
424+ Resy : 0 ,
425+ },
426+ & wms130.LayerBoundingBox {
427+ CRS : "EPSG:25831" ,
428+ Minx : - 470271 ,
429+ Miny : 5.56231e+06 ,
430+ Maxx : 795163 ,
431+ Maxy : 6.18197e+06 ,
432+ Resx : 0 ,
433+ Resy : 0 ,
434+ },
435+ & wms130.LayerBoundingBox {
436+ CRS : "EPSG:25832" ,
437+ Minx : 62461.6 ,
438+ Miny : 5.56555e+06 ,
439+ Maxx : 397827 ,
440+ Maxy : 6.19042e+06 ,
441+ Resx : 0 ,
442+ Resy : 0 ,
443+ },
444+ & wms130.LayerBoundingBox {
445+ CRS : "EPSG:3034" ,
446+ Minx : 2.61336e+06 ,
447+ Miny : 3.509e+06 ,
448+ Maxx : 3.22007e+06 ,
449+ Maxy : 3.84003e+06 ,
450+ Resx : 0 ,
451+ Resy : 0 ,
452+ },
453+ & wms130.LayerBoundingBox {
454+ CRS : "EPSG:3035" ,
455+ Minx : 3.01676e+06 ,
456+ Miny : 3.81264e+06 ,
457+ Maxx : 3.64485e+06 ,
458+ Maxy : 4.15586e+06 ,
459+ Resx : 0 ,
460+ Resy : 0 ,
461+ },
462+ & wms130.LayerBoundingBox {
463+ CRS : "EPSG:3857" ,
464+ Minx : 281318 ,
465+ Miny : 6.48322e+06 ,
466+ Maxx : 820873 ,
467+ Maxy : 7.50311e+06 ,
468+ Resx : 0 ,
469+ Resy : 0 ,
470+ },
471+ & wms130.LayerBoundingBox {
472+ CRS : "EPSG:4258" ,
473+ Minx : 50.2129 ,
474+ Miny : 2.52713 ,
475+ Maxx : 55.7212 ,
476+ Maxy : 7.37403 ,
477+ Resx : 0 ,
478+ Resy : 0 ,
479+ },
480+ & wms130.LayerBoundingBox {
481+ CRS : "EPSG:4326" ,
482+ Minx : 50.2129 ,
483+ Miny : 2.52713 ,
484+ Maxx : 55.7212 ,
485+ Maxy : 7.37403 ,
486+ Resx : 0 ,
487+ Resy : 0 ,
488+ },
489+ & wms130.LayerBoundingBox {
490+ CRS : "CRS:84" ,
491+ Minx : 2.52713 ,
492+ Miny : 50.2129 ,
493+ Maxx : 7.37403 ,
494+ Maxy : 55.7212 ,
495+ Resx : 0 ,
496+ Resy : 0 ,
497+ })
498+
499+ topLayer := wms130.Layer {
500+ Queryable : asPtr (1 ),
501+ Opaque : nil ,
502+ Name : nil ,
503+ Title : * title ,
504+ Abstract : asPtr (mapperutils .EscapeQuotes (wms .Spec .Service .Abstract )),
505+ KeywordList : & wms130.Keywords {Keyword : referenceLayer .Keywords },
506+ CRS : defaultCrs ,
507+ EXGeographicBoundingBox : & defaultBoundingBox ,
508+ BoundingBox : allDefaultBoundingBoxes ,
509+ Dimension : nil ,
510+ Attribution : nil ,
511+ AuthorityURL : nil ,
512+ Identifier : nil ,
513+ MetadataURL : nil ,
514+ DataURL : nil ,
515+ FeatureListURL : nil ,
516+ Style : nil ,
517+ MinScaleDenominator : nil ,
518+ MaxScaleDenominator : nil ,
519+ Layer : nil ,
520+ }
521+
522+ result = append (result , topLayer )
523+ return result
524+ }
525+
332526func pointerValOrDefault [T any ](pointer * T , defaultValue T ) T {
333527 if pointer != nil {
334528 return * pointer
0 commit comments