Skip to content

Commit

Permalink
Merge pull request #224 from PDOK/collection-tiles-fixes
Browse files Browse the repository at this point in the history
fix(tiles): few fixes around collection-level OGC API Tiles:
  • Loading branch information
rkettelerij authored Aug 28, 2024
2 parents 12c52b6 + a5c0298 commit 4c0192f
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 5 deletions.
8 changes: 7 additions & 1 deletion config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -940,13 +940,19 @@ type PropertyFilter struct {

// +kubebuilder:object:generate=true
type Tiles struct {
// Reference to the server (or object storage) hosting the tiles
// Reference to the server (or object storage) hosting the tiles.
// Note: Only marked as optional in CRD to support top-level OR collection-level tiles
// +optional
TileServer URL `yaml:"tileServer" json:"tileServer" validate:"required"`

// Could be 'vector' and/or 'raster' to indicate the types of tiles offered
// Note: Only marked as optional in CRD to support top-level OR collection-level tiles
// +optional
Types []TilesType `yaml:"types" json:"types" validate:"required"`

// Specifies in what projections (SRS/CRS) the tiles are offered
// Note: Only marked as optional in CRD to support top-level OR collection-level tiles
// +optional
SupportedSrs []SupportedSrs `yaml:"supportedSrs" json:"supportedSrs" validate:"required,dive"`

// Optional template to the vector tiles on the tileserver. Defaults to {tms}/{z}/{x}/{y}.pbf.
Expand Down
2 changes: 2 additions & 0 deletions internal/ogc/common/core/templates/conformance.go.html
Original file line number Diff line number Diff line change
Expand Up @@ -194,10 +194,12 @@ <h2 class="card-header h5">Tiles</h2>
<td><a href="http://www.opengis.net/spec/ogcapi-tiles-1/1.0/conf/tilesets-list" target="_blank" aria-label="{{ i18n "To" }} conf/tilesets-list {{ i18n "Definition" }}">http://www.opengis.net/spec/ogcapi-tiles-1/1.0/conf/tilesets-list</a></td>
<td>{{ i18n "Standard" }}</td>
</tr>
{{ if .Config.OgcAPI.Tiles.DatasetTiles }}
<tr>
<td><a href="http://www.opengis.net/spec/ogcapi-tiles-1/1.0/conf/dataset-tilesets" target="_blank" aria-label="{{ i18n "To" }} conf/dataset-tilesets {{ i18n "Definition" }}">http://www.opengis.net/spec/ogcapi-tiles-1/1.0/conf/dataset-tilesets</a></td>
<td>{{ i18n "Standard" }}</td>
</tr>
{{ end }}
{{ if .Config.OgcAPI.Tiles.Collections }}
<tr>
<td><a href="http://www.opengis.net/spec/ogcapi-tiles-1/1.0/conf/geodata-tilesets" target="_blank" aria-label="{{ i18n "To" }} conf/geodata-tilesets {{ i18n "Definition" }}">http://www.opengis.net/spec/ogcapi-tiles-1/1.0/conf/geodata-tilesets</a></td>
Expand Down
2 changes: 2 additions & 0 deletions internal/ogc/common/core/templates/conformance.go.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,9 @@
,"http://www.opengis.net/spec/ogcapi-tiles-1/1.0/conf/core"
,"http://www.opengis.net/spec/ogcapi-tiles-1/1.0/conf/tileset"
,"http://www.opengis.net/spec/ogcapi-tiles-1/1.0/conf/tilesets-list"
{{ if .Config.OgcAPI.Tiles.DatasetTiles }}
,"http://www.opengis.net/spec/ogcapi-tiles-1/1.0/conf/dataset-tilesets"
{{ end }}
{{ if .Config.OgcAPI.Tiles.Collections }}
,"http://www.opengis.net/spec/ogcapi-tiles-1/1.0/conf/geodata-tilesets"
{{ end }}
Expand Down
2 changes: 1 addition & 1 deletion internal/ogc/common/core/templates/landing-page.go.html
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ <h2 class="card-header h5">
</div>
{{ end }}

{{ if .Config.OgcAPI.Tiles }}
{{ if and .Config.OgcAPI.Tiles .Config.OgcAPI.Tiles.DatasetTiles }}
<div class="col-md-4 col-sm-12">
<div class="card h-100">
<h2 class="card-header h5">
Expand Down
2 changes: 1 addition & 1 deletion internal/ogc/common/core/templates/landing-page.go.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"href": "{{ .Config.BaseURL }}/styles"
}
{{ end }}
{{ if .Config.OgcAPI.Tiles }}
{{ if and .Config.OgcAPI.Tiles .Config.OgcAPI.Tiles.DatasetTiles }}
,
{
"rel": "http://www.opengis.net/def/rel/ogc/1.0/tilesets-vector",
Expand Down
6 changes: 4 additions & 2 deletions internal/ogc/tiles/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -217,9 +217,11 @@ func renderTileMatrixTemplates(e *engine.Engine) {
func renderTilesTemplates(e *engine.Engine, collection *config.GeoSpatialCollection, data templateData) {

var breadcrumbs []engine.Breadcrumb
path := tilesPath
collectionID := ""
if collection != nil {
collectionID = collection.ID
path = g.CollectionsPath + "/" + collectionID + tilesPath

breadcrumbs = collectionsBreadcrumb
breadcrumbs = append(breadcrumbs, []engine.Breadcrumb{
Expand All @@ -236,7 +238,7 @@ func renderTilesTemplates(e *engine.Engine, collection *config.GeoSpatialCollect
breadcrumbs = tilesBreadcrumbs
}

e.RenderTemplatesWithParams(tilesPath,
e.RenderTemplatesWithParams(path,
data,
breadcrumbs,
engine.NewTemplateKeyWithName(templatesDir+"tiles.go.json", collectionID),
Expand All @@ -252,7 +254,7 @@ func renderTilesTemplates(e *engine.Engine, collection *config.GeoSpatialCollect
},
}...)

path := tilesPath + "/" + projection
path = tilesPath + "/" + projection
if collection != nil {
path = g.CollectionsPath + "/" + collectionID + tilesPath + "/" + projection
}
Expand Down

0 comments on commit 4c0192f

Please sign in to comment.