Skip to content

Commit 92e4e61

Browse files
committed
Started on input for WMS mapfilegenerator input
1 parent 144b56a commit 92e4e61

File tree

3 files changed

+69
-3
lines changed

3 files changed

+69
-3
lines changed

internal/controller/mapfilegenerator/mapfile_generator.go

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package mapfilegenerator
22

33
import (
44
"encoding/json"
5-
"errors"
65
"fmt"
76
"strings"
87

@@ -50,8 +49,8 @@ func GetConfig[W pdoknlv3.WMSWFS](webservice W, ownerInfo *smoothoperatorv1.Owne
5049
return createConfigForWFS(WFS, ownerInfo)
5150
}
5251
case *pdoknlv3.WMS:
53-
if _, ok := any(webservice).(*pdoknlv3.WMS); ok {
54-
return "", errors.New("not implemented for WMS")
52+
if WMS, ok := any(webservice).(*pdoknlv3.WMS); ok {
53+
return createConfigForWMS(WMS, ownerInfo)
5554
}
5655
default:
5756
return "", fmt.Errorf("unexpected input, webservice should be of type WFS or WMS, webservice: %v", webservice)
@@ -71,3 +70,16 @@ func createConfigForWFS(wfs *pdoknlv3.WFS, ownerInfo *smoothoperatorv1.OwnerInfo
7170
}
7271
return string(jsonConfig), nil
7372
}
73+
74+
func createConfigForWMS(wms *pdoknlv3.WMS, ownerInfo *smoothoperatorv1.OwnerInfo) (config string, err error) {
75+
input, err := MapWMSToMapfileGeneratorInput(wms, ownerInfo)
76+
if err != nil {
77+
return "", err
78+
}
79+
80+
jsonConfig, err := json.MarshalIndent(input, "", " ")
81+
if err != nil {
82+
return "", err
83+
}
84+
return string(jsonConfig), nil
85+
}

0 commit comments

Comments
 (0)