From 18ecdf82ff667ce112b1cf523d85b043c8a74e97 Mon Sep 17 00:00:00 2001 From: Michiel Korpel Date: Wed, 18 Dec 2024 12:38:57 +0100 Subject: [PATCH] refactor(tiles): return map instead of modifying inplace --- internal/ogc/tiles/main.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/internal/ogc/tiles/main.go b/internal/ogc/tiles/main.go index cdd8d949..47926da7 100644 --- a/internal/ogc/tiles/main.go +++ b/internal/ogc/tiles/main.go @@ -78,9 +78,8 @@ func NewTiles(e *engine.Engine) *Tiles { tiles := &Tiles{engine: e} // TileMatrixSetLimits - tiles.tileMatrixSetLimits = make(map[string]map[int]TileMatrixSetLimits) supportedProjections := e.Config.OgcAPI.Tiles.GetProjections() - readTileMatrixSetLimits(tiles.tileMatrixSetLimits, supportedProjections) + tiles.tileMatrixSetLimits = readTileMatrixSetLimits(supportedProjections) // TileMatrixSets renderTileMatrixTemplates(e) @@ -379,7 +378,8 @@ func getCollectionTitle(collectionID string, metadata *config.GeoSpatialCollecti return collectionID } -func readTileMatrixSetLimits(tileMatrixSetLimits map[string]map[int]TileMatrixSetLimits, supportedProjections []config.SupportedSrs) { +func readTileMatrixSetLimits(supportedProjections []config.SupportedSrs) map[string]map[int]TileMatrixSetLimits { + tileMatrixSetLimits := make(map[string]map[int]TileMatrixSetLimits) for _, supportedSrs := range supportedProjections { tileMatrixSetID := config.AllTileProjections[supportedSrs.Srs] yamlFile, err := os.ReadFile(tmsLimitsDir + tileMatrixSetID + ".yaml") @@ -399,6 +399,7 @@ func readTileMatrixSetLimits(tileMatrixSetLimits map[string]map[int]TileMatrixSe } tileMatrixSetLimits[tileMatrixSetID] = tmsLimits } + return tileMatrixSetLimits } func parseTileParams(tileMatrix, tileRow, tileCol string) (int, int, int, error) {