- map.js: Invers-Maske aus Bundeslaender-GeoJSON blendet Nachbarlaender/Meer aus (Even-Odd, alle Ringe -> Enklaven Berlin/Bremen bleiben sichtbar) - map.js: Ausschnitt via setMaxBounds fest auf Deutschland begrenzt - map.js: Grenz-GeoJSON immer laden; gefuellter Umriss als Fallback ohne Tiles - scripts.html/karte.html/hugo.toml: protomaps-leaflet + pmtiles-Basemap - .gitignore: /static/tiles/ (6,7-GB-pmtiles liegt ausserhalb des Repos)
49 lines
1.9 KiB
HTML
49 lines
1.9 KiB
HTML
{{/*
|
|
Karten-Partial. Aufruf mit dict:
|
|
(dict "pages" <slice von Schauplatz-Seiten> "klein" false)
|
|
Baut den Leaflet-Container und bettet die Marker-Daten als JSON ein
|
|
(kein externer Request → CORS-frei, statisch). Der Filter kommt aus explorer.html.
|
|
*/}}
|
|
{{ $pages := .pages }}
|
|
{{ $klein := .klein }}
|
|
{{ $default := .markerColor | default site.Params.kategorieFarbeDefault | default "#1e2758" }}
|
|
|
|
{{/* Farb-Map (Kategorie → Hex) für map.js aus data/kategorien.yaml */}}
|
|
{{ $colorMap := dict }}
|
|
{{ range $k, $v := site.Data.kategorien }}{{ $colorMap = merge $colorMap (dict $k $v.color) }}{{ end }}
|
|
|
|
{{/* Marker-Daten aufbauen */}}
|
|
{{ $places := slice }}
|
|
{{ range $pages }}
|
|
{{ $img := "" }}
|
|
{{ with .Resources.GetMatch "{cover,*featured*,image}.*" }}{{ $img = .RelPermalink }}
|
|
{{ else }}{{ with .Params.image }}{{ $img = . | relURL }}{{ end }}{{ end }}
|
|
{{ if and .Params.lat .Params.lng }}
|
|
{{ $places = $places | append (dict
|
|
"title" .Title
|
|
"subtitle" (.Params.subtitle | default "")
|
|
"url" .RelPermalink
|
|
"lat" .Params.lat
|
|
"lng" .Params.lng
|
|
"categories" (.Params.kategorien | default slice)
|
|
"img" $img
|
|
) }}
|
|
{{ end }}
|
|
{{ end }}
|
|
|
|
{{ $payload := dict
|
|
"places" $places
|
|
"colors" $colorMap
|
|
"defaultColor" $default
|
|
"klein" ($klein | default false)
|
|
"pmtilesUrl" (site.Params.map.pmtilesURL | default ("tiles/germany.pmtiles" | relURL))
|
|
"flavor" (site.Params.map.flavor | default "light")
|
|
"geojsonUrl" ("geo/deutschland-bundeslaender.geojson" | relURL)
|
|
"attribution" (site.Params.map.attribution | default "© OpenStreetMap-Mitwirkende")
|
|
}}
|
|
|
|
<div id="op-map" class="op-map{{ if $klein }} op-map--klein{{ end }}"
|
|
role="application" aria-label="{{ i18n "mapAria" }}"></div>
|
|
|
|
<script type="application/json" id="op-map-data">{{ $payload | jsonify | safeJS }}</script>
|