-
Notifications
You must be signed in to change notification settings - Fork 0
/
climes.html
79 lines (68 loc) · 3.23 KB
/
climes.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
<!doctype html><html><head>
<meta charset=utf8>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1">
<title>Visor de mapes de classificacions climàtiques</title>
<!--libs
-->
<script src="https://unpkg.com/vue@3/dist/vue.global.prod.js"></script>
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-YvpcrYf0tY3lHB60NNkmXc5s9fDVZLESaAA55NDzOxhy9GkcIdslK1eN7N6jIeHz" crossorigin="anonymous"></script>
<!--MULTISELECT-->
<script src="https://unpkg.com/vue-multiselect"></script>
<link rel="stylesheet" href="https://unpkg.com/vue-multiselect/dist/vue-multiselect.min.css">
<!--css general-->
<style>
</style>
</head>
<body>
<!--vue template-->
<div id=app class="container-fluid">
<h1 class="text-center m-4">Visor de mapes de classificacions climàtiques</h1>
<div class="row m-4">
<div class="col-4">
<label for="selectCultiu">Classificació:</label>
<select class="form-select" id="selectCultiu" v-model="selectedMap">
<option v-for="map in maps" :value="map">{{map}}</option>
</select>
</div>
</div>
<div class="row" v-if="selectedMap">
<div class="col-4">
<img :src="createMapFile('2020')" class="img-fluid">
</div>
<div class="col-4">
<img :src="createMapFile('RCP45')" class="img-fluid">
</div>
<div class="col-4">
<img :src="createMapFile('RCP85')" class="img-fluid">
</div>
</div>
<div class="alert alert-primary text-center m-4">
Els mapes d'aquesta pàgina son resultats provisionals, no es poden donar per vàlids en cap cas.
</div>
</div>
<!--vue instance-->
<script>
let app=Vue.createApp({
data(){return {
maps: [],
selectedMap: null,
}},
methods:{
createMapFile(scenari){
return `assets/climate_classifications/AGRICULTURA_${this.selectedMap}_${scenari}.png`
}
},
computed:{
},
}).mount("#app");
app.maps = JSON.parse('["AGRICULTURA_LLIUR_GEL_PRESENT.png","AGRICULTURA_LLIUR_GEL_RCP45.png","AGRICULTURA_LLIUR_GEL_RCP85.png","AGRICULTURA_PRESCOTT_PRESENT.png","AGRICULTURA_PRESCOTT_RCP45.png","AGRICULTURA_PRESCOTT_RCP85.png","AGRICULTURA_REG_HUM_2020.png","AGRICULTURA_REG_HUM_RCP45.png","AGRICULTURA_REG_HUM_RCP85.png","AGRICULTURA_TIPUS_ESTIU_2020.png","AGRICULTURA_TIPUS_ESTIU_RCP45.png","AGRICULTURA_TIPUS_ESTIU_RCP85.png","AGRICULTURA_TIPUS_HIVER_2020.png","AGRICULTURA_TIPUS_HIVER_RCP45.png","AGRICULTURA_TIPUS_HIVER_RCP85.png","AGRICULTURA_WINKLER_PRESENT.png","AGRICULTURA_WINKLER_RCP45.png","AGRICULTURA_WINKLER_RCP85.png"]')
app.maps = app.maps.map(e => e.replace('AGRICULTURA_', '')
.replace(/_([A-Z]|\d)+\.png$/, ''))
// get unique
app.maps = [...new Set(app.maps)];
app.maps.sort((a,b)=>{
return a<b?-1:1;
});
</script>