github.com/PDOK/gokoala@v0.50.6/internal/ogc/tiles/templates/tiles.go.html (about) 1 {{- /*gotype: github.com/PDOK/gokoala/internal/engine.TemplateData*/ -}} 2 {{define "content"}} 3 <hgroup> 4 <h1 class="title" id="title">{{ .Config.Title }} - {{ i18n "Tiles" }}</h1> 5 </hgroup> 6 <div class="row py-3"> 7 <div class="col-md-12"> 8 <p> 9 {{ i18n "TilesTextHTML" }} 10 </p> 11 </div> 12 </div> 13 <div class="row"> 14 {{ $baseUrl := .Config.BaseURL }} 15 {{ $defaultSrs := (index .Config.OgcAPI.Tiles.SupportedSrs 0)}} 16 {{ $projections := dict "EPSG:28992" "NetherlandsRDNewQuad" "EPSG:3035" "EuropeanETRS89_LAEAQuad" "EPSG:3857" "WebMercatorQuad" }} 17 <div class="col-md-5"> 18 <table class="table table-borderless table-sm w-auto"> 19 <tbody> 20 <tr> 21 {{ if eq (len .Config.OgcAPI.Tiles.SupportedSrs) 1 }} 22 <td class="w-auto text-nowrap fw-bold"> 23 Tile Matrix Set 24 </td> 25 <td class="w-auto px-2"> 26 {{ get $projections $defaultSrs.Srs }} 27 </td> 28 {{ else }} 29 <td class="w-auto text-nowrap"> 30 <label for="srs" class="col-form-label fw-bold">Tile Matrix Set</label> 31 </td> 32 <td class="w-auto px-2"> 33 <select id="srs" class="form-select"> 34 {{ range $srs := .Config.OgcAPI.Tiles.SupportedSrs }} 35 <option value="{{ $srs.Srs }}">{{ get $projections (index $srs).Srs }}</option> 36 {{ end }} 37 </select> 38 </td> 39 {{ end }} 40 </tr> 41 <tr> 42 {{ if .Config.LastUpdatedBy }} 43 <td class="w-auto text-nowrap fw-bold"> 44 {{ i18n "UpdatedBy" }} {{ .Config.LastUpdatedBy }} {{ i18n "On" }} 45 </td> 46 {{ else }} 47 <td class="w-auto text-nowrap fw-bold"> 48 {{ i18n "LastUpdated" }} 49 </td> 50 {{ end }} 51 <td id="field-updated" class="w-auto px-2"> 52 {{ if .Config.LastUpdated}}{{ toDate "2006-01-02T15:04:05Z07:00" .Config.LastUpdated | date "2006-01-02" }}{{ end }} 53 </td> 54 </tr> 55 <tr> 56 <td class="w-auto text-nowrap fw-bold"> 57 Type 58 </td> 59 <td id="field-type" class="w-auto px-2"> 60 {{ (index .Config.OgcAPI.Tiles.Types 0) | toString | title }} 61 </td> 62 </tr> 63 <tr> 64 <td class="w-auto text-nowrap fw-bold"> 65 CRS 66 </td> 67 <td id="field-srs" class="w-auto px-2"> 68 {{ $defaultSrs.Srs }} 69 </td> 70 </tr> 71 <tr> 72 <td class="w-auto text-nowrap fw-bold"> 73 Metadata 74 </td> 75 <td id="field-metadata" class="w-auto px-2"> 76 <a id="href-metadata" href="tiles/{{ get $projections $defaultSrs.Srs }}" aria-label="{{ i18n "View" }} tile matrix set metadata">{{ i18n "View" }} metadata</a> 77 </td> 78 </tr> 79 </tbody> 80 </table> 81 </div> 82 <div class="col-md-7"> 83 <table class="table table-borderless table-sm w-auto"> 84 <tbody> 85 <tr> 86 <td class="w-auto text-nowrap fw-bold"> 87 URL template 88 </td> 89 <td class="w-auto px-2"> 90 <code id="field-url-template">{{ $baseUrl }}/tiles/{{ get $projections $defaultSrs.Srs }}/{z}/{y}/{x}?f=mvt</code> 91 </td> 92 </tr> 93 <tr> 94 <td class="w-auto text-nowrap fw-bold"> 95 {{ i18n "Example" }} URL 96 </td> 97 <td class="w-auto px-2"> 98 <code id="field-url-example">{{ $baseUrl }}/tiles/{{ get $projections $defaultSrs.Srs }}/{{ $defaultSrs.ZoomLevelRange.End }}/2047/2048?f=mvt</code> 99 </td> 100 </tr> 101 </tbody> 102 </table> 103 <link rel="stylesheet" type="text/css" href="view-component/styles.css"> 104 <script type="text/javascript" src="view-component/main.js"></script> 105 <script type="text/javascript" src="view-component/polyfills.js"></script> 106 <script type="text/javascript" src="view-component/runtime.js"></script> 107 <app-vectortile-view id="vectortileviewer" class="card vectortile-view" 108 tile-url="{{ $baseUrl }}/tiles/{{ get $projections $defaultSrs.Srs }}" 109 {{ if .Config.OgcAPI.Styles }}style-url="{{ $baseUrl }}/styles/{{ .Config.OgcAPI.Styles.Default }}?f=mapbox"{{ end }} 110 center-x="5.3896944" center-y="52.1562499" 111 show-grid="false" show-object-info="true"> 112 </app-vectortile-view> 113 <noscript>Enable Javascript to display vector tiles viewer</noscript> 114 </div> 115 </div> 116 <script> 117 document.addEventListener('input', function (event) { 118 // only operate on srs dropdown 119 if (event.target.id !== 'srs') return; 120 121 // update table fields 122 const selectedSrs = event.target.value 123 let tileset; 124 {{ range $index, $srs := .Config.OgcAPI.Tiles.SupportedSrs }} 125 {{ if $index }}else {{ end }}if (selectedSrs === '{{ $srs.Srs }}') { 126 tileset = '{{ get $projections $srs.Srs }}' 127 }{{ end }} 128 129 const srsField = document.getElementById('field-srs'); 130 srsField.textContent = selectedSrs; 131 132 const urlTemplateField = document.getElementById('field-url-template'); 133 urlTemplateField.textContent = '{{ $baseUrl }}/tiles/' + tileset + '/{z}/{y}/{x}?f=mvt'; 134 135 const metadataHref = document.getElementById('href-metadata'); 136 metadataHref.setAttribute('href', 'tiles/' + tileset); 137 138 // update tile-url and zoom in app-vectortile-view 139 const viewer = document.getElementById('vectortileviewer'); 140 viewer.setAttribute('tile-url', '{{ $baseUrl }}/tiles/' + tileset); 141 }, false); 142 143 vectortileviewer.addEventListener('activeTileUrl', activeUrl => { 144 const urlExampleField = document.getElementById('field-url-example'); 145 urlExampleField.textContent = activeUrl.detail 146 }); 147 </script> 148 {{end}}