Skip to content

Commit

Permalink
refactor(tiles): return map instead of modifying inplace
Browse files Browse the repository at this point in the history
  • Loading branch information
kad-korpem committed Dec 18, 2024
1 parent 1afc2be commit 18ecdf8
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions internal/ogc/tiles/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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")
Expand All @@ -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) {
Expand Down

0 comments on commit 18ecdf8

Please sign in to comment.