aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuilhem Moulin <guilhem@fripost.org>2024-01-31 03:11:06 +0100
committerGuilhem Moulin <guilhem@fripost.org>2024-01-31 05:48:43 +0100
commitfff0407ca9148df17f627c6f7f956194bb1328f7 (patch)
tree0b6ec0687de84f57d2e886677104e6e150456fe0
parent60e569b99d07faf14e4e8f9c79180912fec01fe8 (diff)
Add layer for dams (from SMHI).
-rw-r--r--index.html4
-rw-r--r--main.js80
2 files changed, 80 insertions, 4 deletions
diff --git a/index.html b/index.html
index 804bcc8..25ee9aa 100644
--- a/index.html
+++ b/index.html
@@ -26,6 +26,10 @@
<li><i>Transmissionsnät för el</i> från
<a href="https://svk.se" target="_blank">Svenska Kraftnät (SvK)</a>.
</li>
+ <li><i>Dammregistret</i> från
+ <a href="https://smhi.se" target="_blank">Sveriges meteorologiska och hydrologiska institut (SMHI)</a>,
+ CC-BY-4.0 (<a href="https://www.smhi.se/data/oppna-data/villkor-for-anvandning-1.30622" target="_blank">öppna data</a>).
+ </li>
<li><i>Mineralrättsregistret</i> från
<a href="https://www.sgu.se/bergsstaten/" target="_blank">Bergsstaten</a>.
</li>
diff --git a/main.js b/main.js
index fe50f80..f48f6a6 100644
--- a/main.js
+++ b/main.js
@@ -1320,6 +1320,70 @@ const layers = {
});
}),
},
+
+ /* Documentation at
+ * https://www.smhi.se/polopoly_fs/1.34541!/dammprod%202013_3%2C%20beskrivning%2C%20SVAR2012_2.pdf
+ * */
+ smhi_dam: {
+ popoverTitle: 'Damm',
+ popover: [
+ ['Dammenhetens namn', 'dnamn'],
+ ['Dammanläggningens namn', 'namn'],
+ ['Länsnr', 'lst_objid', { classes: ['feature-objid'] }],
+ ['Status', 'status', { fn: (v) => v === 0 ? '' : v === 1 ? 'Befintlig damm' : v === 2 ? 'Fd. damm' : v }],
+ ['Regleringstyp', 'regl_typ', { fn: (v) => v === 0 ? '' : v }],
+ ['Byggår', 'byggar', { fn: (v) => v === 0 ? '' : v }],
+ ['Dammhöjd', 'dammhojd', { unit: 'm', fn: (v) => v === 0 ? '' : v }],
+ ['Krönlängd', 'kron', { unit: 'm', fn: (v) => v === 0 ? '' : v }],
+ ['Fiskväg', 'fiskvag', { fn: (v) =>
+ v === 0 ? '' :
+ v === 1 ? 'Bassängtrappa' :
+ v === 2 ? 'Denilränna' :
+ v === 3 ? 'Slitsränna' :
+ v === 4 ? 'Omlöp' :
+ v === 5 ? 'Inlöp' :
+ v === 6 ? 'Ålledare' :
+ v === 7 ? 'Smoltränna' :
+ v === 8 ? 'Okänd typ' :
+ v === 9 ? 'Ingen' :
+ v === 10 ? 'Annan' :
+ v }],
+ ['Huvudavrinningsområdesnummer', 'haro', { classes: ['feature-objid'] } ],
+ ['Vattendistrikt', 'RBD', { classes: ['feature-objid'] } ],
+ ['Verksamhet', 'verksmht', { fn: (v) =>
+ v === 0 ? '' :
+ v === 1 ? 'Kraftproduktion' :
+ v === 2 ? 'Industri' :
+ v === 3 ? 'Sjöfart' :
+ v === 4 ? 'Invallning' :
+ v === 5 ? 'Vattenförsörjning' :
+ v === 6 ? 'Spegeldamm' :
+ v === 7 ? 'Historisk' :
+ v === 8 ? 'Övrigt' :
+ v }],
+ ['Högsta dämningsgräns', 'dg', { unit: 'm', fn: (v) => v === 0 ? '' : v }],
+ ['Lägsta sänkningsgräns', 'sg', { unit: 'm', fn: (v) => v === 0 ? '' : v }],
+ ['Magasinsyta', 'my', { unit: 'km²', fn: (v) => v === 0 ? '' : v }],
+ ['Reglerbar volym', 'my', { unit: 'Mm³', fn: (v) => v === 0 ? '' : v }],
+ ['Kommentar', 'kommentar'],
+ ['Damm-ID', 'dammid', { classes: ['feature-objid'] }],
+ ],
+ style: [2, 3, 4, 4, 4, 6, 8, 8, 8, 10, 16, 32].map(function(width) {
+ return new Style({
+ zIndex: 59,
+ image: new CircleStyle({
+ radius: width,
+ fill: new Fill({
+ color: 'rgb(219, 30, 42)',
+ }),
+ stroke: new Stroke({
+ width: Math.log2(width) * 2/5,
+ color: 'rgb(128, 17, 25)',
+ }),
+ }),
+ });
+ }),
+ },
};
const layerHierarchy = [
@@ -1341,6 +1405,10 @@ const layerHierarchy = [
],
},
{
+ text: 'Dammar',
+ layer: 'smhi_dam',
+ },
+ {
text: 'Mineralrättigheter',
children: [
{
@@ -1729,11 +1797,15 @@ map.addLayer(vectorLayer2);
const text0 = document.createTextNode(x.text);
label0.appendChild(text0);
- const body = document.createElement('div');
- collapse.appendChild(body);
- body.classList.add('accordion-body');
+ if (x.children === undefined || x.children.length === 0) {
+ item.replaceChild(span0, header);
+ } else {
+ const body = document.createElement('div');
+ collapse.appendChild(body);
+ body.classList.add('accordion-body');
- addAccordionGroup(body, x.children);
+ addAccordionGroup(body, x.children);
+ }
input0.onclick = function(event) {
return onClickFunction(x._layers, event);