@@ -119,7 +119,7 @@ func MapWMSToMapfileGeneratorInput(wms *pdoknlv3.WMS, ownerInfo *smoothoperatorv
119119 NamespaceURI : fmt .Sprintf ("%s://%s.geonovum.nl" , protocol , datasetName ),
120120 OnlineResource : pdoknlv3 .GetHost (),
121121 Path : mapperutils .GetPath (wms ),
122- MetadataId : "onbekend" ,
122+ MetadataId : wms . Spec . Service . Inspire . ServiceMetadataURL . CSW . MetadataIdentifier ,
123123 DatasetOwner : & owner ,
124124 AuthorityURL : & authorityUrl ,
125125 AutomaticCasing : wms .Spec .Options .AutomaticCasing ,
@@ -128,8 +128,67 @@ func MapWMSToMapfileGeneratorInput(wms *pdoknlv3.WMS, ownerInfo *smoothoperatorv
128128 },
129129 AccessConstraints : accessConstraints ,
130130 Layers : []WMSLayer {},
131- Templates : "/src /data/config/templates" ,
131+ Templates : "/srv /data/config/templates" ,
132132 }
133133
134+ allLayers := wms .Spec .Service .GetAllLayers ()
135+ for _ , serviceLayer := range allLayers [1 :] {
136+ layerExtent := extent
137+ if len (serviceLayer .BoundingBoxes ) > 0 {
138+ layerExtent = serviceLayer .BoundingBoxes [0 ].ToExtent ()
139+ }
140+
141+ layer := WMSLayer {
142+ BaseLayer : BaseLayer {
143+ Name : serviceLayer .Name ,
144+ Title : smoothoperatorutils .PointerVal (serviceLayer .Title , "" ),
145+ Abstract : smoothoperatorutils .PointerVal (serviceLayer .Abstract , "" ),
146+ Keywords : strings .Join (serviceLayer .Keywords , "," ),
147+ Extent : layerExtent ,
148+ MetadataId : serviceLayer .DatasetMetadataURL .CSW .MetadataIdentifier ,
149+ Columns : []Column {},
150+ GeometryType : nil ,
151+ GeopackagePath : nil ,
152+ TableName : nil ,
153+ Postgis : nil ,
154+ },
155+ GroupName : "" ,
156+ Styles : []Style {},
157+ Offsite : "" ,
158+ GetFeatureInfoIncludesClass : false ,
159+ }
160+
161+ for _ , style := range serviceLayer .Styles {
162+ stylePath := "/styling/" + smoothoperatorutils .PointerVal (style .Visualization , "" )
163+ layer .Styles = append (layer .Styles , Style {
164+ Path : stylePath ,
165+ Title : smoothoperatorutils .PointerVal (style .Title , "" ),
166+ })
167+ }
168+
169+ if serviceLayer .Data != nil && serviceLayer .Data .Gpkg != nil {
170+ gpkg := serviceLayer .Data .Gpkg
171+
172+ layer .Columns = append (layer .Columns , Column {
173+ Name : "fuuid" ,
174+ Alias : nil ,
175+ })
176+
177+ for _ , column := range serviceLayer .Data .Gpkg .Columns {
178+ layer .Columns = append (layer .Columns , Column {
179+ Name : column .Name ,
180+ Alias : column .Alias ,
181+ })
182+ }
183+
184+ layer .GeometryType = & gpkg .GeometryType
185+ splitBlobKey := strings .Split (gpkg .BlobKey , "/" )
186+ geopackageConstructedPath := "/srv/data/gpkg/" + splitBlobKey [len (splitBlobKey )- 1 ]
187+ layer .GeopackagePath = & geopackageConstructedPath
188+ layer .TableName = & gpkg .TableName
189+ }
190+
191+ result .Layers = append (result .Layers , layer )
192+ }
134193 return result , nil
135194}
0 commit comments