Skip to content

Commit

Permalink
feat(tiles): support collection-level OGC API tiles (geodata tiles).
Browse files Browse the repository at this point in the history
  • Loading branch information
rkettelerij committed Aug 23, 2024
1 parent 9704388 commit ccd2d8b
Show file tree
Hide file tree
Showing 9 changed files with 44 additions and 18 deletions.
14 changes: 9 additions & 5 deletions assets/i18n/en.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,15 @@ WithStylesPlain: One or more styles are also available.
Styles: Styles
StylesText: One or more official styles as specified by the supplier. Styles are made available in the Mapbox format.
TileMatrixSets: Tile Matrix Sets
TileMatrixSetsText: |-
TileMatrixSetsDatasetText: |-
Description of the Tile Matrix Sets that are made available via this API. Note that all zoom levels
of the tile matrix are described. See the <i>Tile Matrix Set Limits</i> on the <a href="tiles" aria-label="Go to tiles">Tiles</a>
pages to see what zoom levels are supported by this API.
TileMatrixSetsCollectionText: |-
Description of the Tile Matrix Sets that are made available via this API. Note that all zoom levels
of the tile matrix are described. See the <i>Tile Matrix Set Limits</i> on the Tiles pages
(within the <a href="collections" aria-label="Go to collections">collections</a>) to see what zoom levels are supported by this API.
# Conformance page
ConformanceAbstract: Below are references to OGC API conformance classes to which this service conforms. <br/>The status column indicates whether the given specification is deemed an official standard by the OGC.
Expand All @@ -60,19 +65,18 @@ Draft: Draft
NetherlandsRDNewQuadAbstract: |-
The tiles can be requested via the URL template below, where
<small><code>{z}/{y}/{x}</code></small> is a reference to a tile according to the
<a href="tileMatrixSets/NetherlandsRDNewQuad" aria-label="Go to tile matrix set NetherlandsRDNewQuad">NetherlandsRDNewQuad</a> tiling scheme. In some tools it is
also possible to load this through <a href="tiles/NetherlandsRDNewQuad?f=tilejson" aria-label="Go to NetherlandsRDNewQuad as TileJSON">TileJSON</a>.
<a href="tileMatrixSets/NetherlandsRDNewQuad" aria-label="Go to tile matrix set NetherlandsRDNewQuad">NetherlandsRDNewQuad</a> tiling scheme.
In some tools it is also possible to load this through
WebMercatorQuadAbstract: |-
The tiles can be requested via the URL template below, where
<small><code>{z}/{y}/{x}</code></small> is a reference to a tile according to the
<a href="tileMatrixSets/WebMercatorQuad" aria-label="Go to tile matrix set WebMercatorQuad">WebMercatorQuad</a> tiling scheme. In some tools it is
also possible to load this through <a href="tiles/WebMercatorQuad?f=tilejson" aria-label="Go to WebMercatorQuad as TileJSON">TileJSON</a>.
In some tools it is also possible to load this through
EuropeanETRS89_LAEAQuadAbstract: |-
The tiles can be requested via the URL template below, where
<small><code>{z}/{y}/{x}</code></small> is a reference to a tile according to the
<a href="tileMatrixSets/EuropeanETRS89_LAEAQuad" aria-label="Go to tile matrix set EuropeanETRS89_LAEAQuad">EuropeanETRS89_LAEAQuad</a> tiling scheme.
In some tools it is also possible to load this through
<a href="tiles/EuropeanETRS89_LAEAQuad?f=tilejson" aria-label="Go to EuropeanETRS89_LAEAQuad as TileJSON">TileJSON</a>.
AvailableZoomLevels: The tiles are available at the following zoomlevels
ZoomLevel: Zoom level
MinimumValue: Minimum value
Expand Down
15 changes: 8 additions & 7 deletions assets/i18n/nl.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,14 @@ WithStylesPlain: Ook worden er styles beschikbaar gesteld.
Styles: Styles
StylesText: Betreft één of meerdere officiële styles van/door de aanbieder gespecificeerd. Styles worden beschikbaar gesteld in het Mapbox formaat.
TileMatrixSets: Tile Matrix Sets
TileMatrixSetsText: |-
TileMatrixSetsDatasetText: |-
Beschrijving van de Tile Matrix Sets die via deze API worden ontsloten. Merk op dat alle zoomniveaus
van de tile matrix zijn beschreven. Zie de <i>Tile Matrix Set Limits</i> op de <a href="tiles" aria-label="Ga naar tiles">Tiles</a>
pagina's om te zien welke zoomniveaus door deze API worden ondersteund.
TileMatrixSetsCollectionText: |-
Beschrijving van de Tile Matrix Sets die via deze API worden ontsloten. Merk op dat alle zoomniveaus
van de tile matrix zijn beschreven. Zie de <i>Tile Matrix Set Limits</i> op de Tiles pagina's
(binnen de <a href="collections" aria-label="Ga naar collections">collections</a>) om te zien welke zoomniveaus door deze API worden ondersteund.
# Conformance page
ConformanceAbstract: Hieronder staan verwijzingen naar de OGC API conformiteitsklassen waaraan deze service voldoet. <br/>De statuskolom geeft aan of de betreffende specificatie reeds tot officiële standaard is verklaard door het OGC.
Expand All @@ -61,20 +65,17 @@ NetherlandsRDNewQuadAbstract: |-
De tiles zijn op te vragen via onderstaande URL-template. Daarbij is
<small><code>{z}/{y}/{x}</code></small> een verwijzing naar een
tile volgens het <a href="tileMatrixSets/NetherlandsRDNewQuad" aria-label="Ga naar tile matrix set NetherlandsRDNewQuad">NetherlandsRDNewQuad</a> tiling scheme.
In sommige tools is het ook mogelijk om dit via <a href="tiles/NetherlandsRDNewQuad?f=tilejson" aria-label="Ga naar NetherlandsRDNewQuad als TileJSON">TileJSON</a>
in te laden.
In sommige tools is het ook mogelijk om dit in te laden via
WebMercatorQuadAbstract: |-
De tiles zijn op te vragen via onderstaande URL-template. Daarbij is
<small><code>{z}/{y}/{x}</code></small> een verwijzing naar een
tile volgens het <a href="tileMatrixSets/WebMercatorQuad" aria-label="Ga naar tile matrix set WebMercatorQuad">WebMercatorQuad</a> tiling scheme.
In sommige tools is het ook mogelijk om dit via <a href="tiles/WebMercatorQuad?f=tilejson" aria-label="Ga naar WebMercatorQuad als TileJSON">TileJSON</a>
in te laden.
In sommige tools is het ook mogelijk om dit in te laden via
EuropeanETRS89_LAEAQuadAbstract: |-
De tiles zijn op te vragen via onderstaande URL-template. Daarbij is
<small><code>{z}/{y}/{x}</code></small> een verwijzing naar een
tile volgens het <a href="tileMatrixSets/EuropeanETRS89_LAEAQuad" aria-label="Ga naar tile matrix set EuropeanETRS89_LAEAQuad">EuropeanETRS89_LAEAQuad</a> tiling scheme.
In sommige tools is het ook mogelijk om dit via <a href="tiles/EuropeanETRS89_LAEAQuad?f=tilejson" aria-label="Ga naar EuropeanETRS89_LAEAQuad als TileJSON">TileJSON</a>
in te laden.
In sommige tools is het ook mogelijk om dit in te laden via
AvailableZoomLevels: De tiles zijn beschikbaar op de volgende zoomniveaus
ZoomLevel: Zoomniveau
MinimumValue: Minimale waarde
Expand Down
13 changes: 13 additions & 0 deletions internal/engine/templatefuncs.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package engine
import (
htmltemplate "html/template"
"log"
"reflect"
"strconv"
"strings"
texttemplate "text/template"
Expand Down Expand Up @@ -30,6 +31,7 @@ func init() {
"humansize": humanSize,
"bytessize": bytesSize,
"isdate": isDate,
"hasfield": hasField,
}
sprigFuncs := sprig.FuncMap() // we also support https://github.com/go-task/slim-sprig functions
globalTemplateFuncs = combineFuncMaps(customFuncs, sprigFuncs)
Expand Down Expand Up @@ -111,3 +113,14 @@ func isDate(v any) bool {
}
return false
}

func hasField(v interface{}, name string) bool {
rv := reflect.ValueOf(v)
if rv.Kind() == reflect.Ptr {
rv = rv.Elem()
}
if rv.Kind() != reflect.Struct {
return false
}
return rv.FieldByName(name).IsValid()
}
6 changes: 5 additions & 1 deletion internal/ogc/common/core/templates/landing-page.go.html
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,11 @@ <h2 class="card-header h5">
</h2>
<div class="card-body">
<p>
{{ i18n "TileMatrixSetsText" }}
{{ if .Config.OgcAPI.Tiles.DatasetTiles }}
{{ i18n "TileMatrixSetsDatasetText" }}
{{ else if .Config.OgcAPI.Tiles.Collections }}
{{ i18n "TileMatrixSetsCollectionText" }}
{{ end }}
{{ i18n "AvailableIn" }}
</p>
<small class="text-body-secondary">{{ i18n "ViewAs" }} <a href="tileMatrixSets?f=json" target="_blank" aria-label="{{ i18n "TileMatrixSets" }} {{ i18n "As" }} JSON">JSON</a></small>
Expand Down
6 changes: 5 additions & 1 deletion internal/ogc/tiles/templates/tileMatrixSets.go.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@ <h1 class="title" id="title">{{ .Config.Title }} - {{ i18n "TileMatrixSets" }}</
<div class="row py-3">
<div class="col-md-12">
<p>
{{ i18n "TileMatrixSetsText" }}
{{ if .Config.OgcAPI.Tiles.DatasetTiles }}
{{ i18n "TileMatrixSetsDatasetText" }}
{{ else if .Config.OgcAPI.Tiles.Collections }}
{{ i18n "TileMatrixSetsCollectionText" }}
{{ end }}
</p>
<table class="table table-striped">
<thead>
Expand Down
2 changes: 1 addition & 1 deletion internal/ogc/tiles/templates/tiles.go.html
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ <h1 class="title" id="title">{{ .Config.Title }} - {{ i18n "Tiles" }}</h1>
Metadata
</td>
<td id="field-metadata" class="w-auto px-2">
<a id="href-metadata" href="tiles/{{ get $projections $defaultSrs.Srs }}" aria-label="{{ i18n "View" }} tile matrix set metadata">{{ i18n "View" }} metadata</a>
<a id="href-metadata" href="{{ $baseUrlTiles }}/tiles/{{ get $projections $defaultSrs.Srs }}" aria-label="{{ i18n "View" }} tile matrix set metadata">{{ i18n "View" }} metadata</a>
</td>
</tr>
</tbody>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ <h1 class="title" id="title">EuropeanETRS89_LAEAQuad</h1>
<div class="row py-3">
<div class="col-md-12">
<p>
{{ i18n "EuropeanETRS89_LAEAQuadAbstract" }}
{{ i18n "EuropeanETRS89_LAEAQuadAbstract" }} <a href="{{ .Params.BaseURL }}/tiles/EuropeanETRS89_LAEAQuad?f=tilejson" aria-label="Open TileJSON">TileJSON</a>.
</p>
<p>
URL template: <code>{{ .Params.BaseURL }}/tiles/EuropeanETRS89_LAEAQuad/{z}/{y}/{x}?f=mvt</code>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ <h1 class="title" id="title">NetherlandsRDNewQuad</h1>
<div class="row py-3">
<div class="col-md-12">
<p>
{{ i18n "NetherlandsRDNewQuadAbstract" }}
{{ i18n "NetherlandsRDNewQuadAbstract" }} <a href="{{ .Params.BaseURL }}/tiles/NetherlandsRDNewQuad?f=tilejson" aria-label="Open TileJSON">TileJSON</a>.
</p>
<p>
URL template: <code>{{ .Params.BaseURL }}/tiles/NetherlandsRDNewQuad/{z}/{y}/{x}?f=mvt</code>
Expand Down
2 changes: 1 addition & 1 deletion internal/ogc/tiles/templates/tiles/WebMercatorQuad.go.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ <h1 class="title" id="title">WebMercatorQuad</h1>
<div class="row py-3">
<div class="col-md-12">
<p>
{{ i18n "WebMercatorQuadAbstract" }}
{{ i18n "WebMercatorQuadAbstract" }} <a href="{{ .Params.BaseURL }}/tiles/WebMercatorQuad?f=tilejson" aria-label="Open TileJSON">TileJSON</a>.
</p>
<p>
URL template: <code>{{ .Params.BaseURL }}/tiles/WebMercatorQuad/{z}/{y}/{x}?f=mvt</code>
Expand Down

0 comments on commit ccd2d8b

Please sign in to comment.