forked from maigva/maps
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
203 lines (162 loc) · 9.26 KB
/
index.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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
<!DOCTYPE html>
<html>
<head>
<title> Mapa Coropletico COVID 19 nº Casos </title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="shortcut icon" type="image/x-icon" href="docs/images/favicon.ico" />
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.5.1/dist/leaflet.css" integrity="sha512-xwE/Az9zrjBIphAcBb3F6JVqxf46+CDLwfLMHloNu6KEQCAWi6HcDUbeOfBIptF7tcCzusKFjFw2yuvEpDL9wQ==" crossorigin=""/>
<script src="https://unpkg.com/leaflet@1.5.1/dist/leaflet.js" integrity="sha512-GffPMF3RvMeYyc1LWMHtK8EbPv0iNZ8/oTtHPx9/cc2ILxQ+u905qIwdpULaqDkyBKgOaB57QTMg7ztg8Jm2Og==" crossorigin=""></script>
<!-- <script src="https://unpkg.com/shpjs@latest/dist/shp.js"></script>
<script src="https://unpkg.com/shpjs@latest/dist/shp.min.js"> </script> -->
<style>
html, body {
height: 100%;
margin: 0;
}
#map {
width: 600px;
height: 400px;
}
</style>
<style>#map { width: 500px; height: 800px; }
.info { padding: 6px 8px; font: 14px/16px Arial, Helvetica, sans-serif; background: white; background: rgba(255,255,255,0.8); box-shadow: 0 0 15px rgba(0,0,0,0.2); border-radius: 5px; } .info h4 { margin: 0 0 5px; color: #777; }
.legend { text-align: left; line-height: 18px; color: #555; } .legend i { width: 18px; height: 18px; float: left; margin-right: 8px; opacity: 0.5; }</style>
</head>
<body>
<div id='map'></div>
<script type="text/javascript" src="ca_departamentos.js"></script>
<script type="text/javascript">
var map = L.map('map').setView([39.4756096, -0.3653632], 8 , hospitals);
L.tileLayer('https://api.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token=pk.eyJ1IjoibWFwYm94IiwiYSI6ImNpejY4NXVycTA2emYycXBndHRqcmZ3N3gifQ.rJcFIG214AriISLbB6B5aw', {
maxZoom: 18,
attribution: 'Map data © <a href="https://www.openstreetmap.org/">OpenStreetMap</a> contributors, ' +
'<a href="https://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, ' +
'Imagery © <a href="https://www.mapbox.com/">Mapbox</a>',
id: 'mapbox.light'
}).addTo(map);
var hospitals = L.layerGroup();
L.marker([40.463721, 0.449957]).addTo(map).bindPopup('<b>HOSPITAL COMARCAL DE VINAROZ </b><br> PRE: 4.10 - PRO: 4.09 - xHL7.WS: no - EPAT: 4.3').addTo(hospitals),
L.marker([40.002826, -0.041842]).addTo(map).bindPopup('<b>HOSPITAL LA MAGDALENA</b><br> PRE: 0 - xHL7: 0 - EPAT: 0').addTo(hospitals),
L.marker([39.997007, -0.036435]).addTo(map).bindPopup('<b>HOSPITAL GENERAL DE CASTELLÓN </b><br> PRE: 4.11 - PRO: 4.10 - xHL7.WS: 4.10 - EPAT: 4.10').addTo(hospitals),
L.marker([39.984089, -0.046005]).addTo(map).bindPopup('Fundación Hospital Provincial de Castellón.').addTo(hospitals),
L.marker([39.92418, -0.096946]).addTo(map).bindPopup('Hospital La Plana.').addTo(hospitals),
L.marker([39.674343, -0.231099]).addTo(map).bindPopup('Hospital de Sagunto (Mini Fe).').addTo(hospitals),
L.marker([39.848079, -0.49163]).addTo(map).bindPopup('Hospital de Segorbe.').addTo(hospitals),
L.marker([39.685689, -0.429357]).addTo(map).bindPopup('Hospital de Dr Moliner.').addTo(hospitals),
L.marker([39.48839, -1.089342]).addTo(map).bindPopup('<b>HOSPITAL DE REQUENA </b><br> PRE: 4.9 - PRO: 4.9 - xHL7.WS: no - EPAT: no').addTo(hospitals),
L.marker([39.485543, -0.452875]).addTo(map).bindPopup('Hospital de Manises.').addTo(hospitals),
L.marker([39.641155, -0.619311]).addTo(map).bindPopup('Hospital de Lliria.').addTo(hospitals),
L.marker([39.453241, -0.395]).addTo(map).bindPopup('Hospital Padre Jofre.').addTo(hospitals),
L.marker([39.490983, -0.403297]).addTo(map).bindPopup('<b>HOSPITAL ARNAU DE VILLANOVA</b><br> PRE: 4.9 - PRO: 4.9 - xHL7.WS: 4.9 - EPAT: 4.03').addTo(hospitals),
L.marker([39.478884, -0.361905]).addTo(map).bindPopup('<b>HOSPITAL CLINICO UNIVERSITARI</b><br> PRE: 4.10 - PRO: 4.10 - xHL7.WS: 4.10 - EPAT: 4.03').addTo(hospitals),
L.marker([39.475176, -0.32533]).addTo(map).bindPopup('Hospital Malvarrosa.').addTo(hospitals),
L.marker([39.468184, -0.408361]).addTo(map).bindPopup('Hospital consorcio General Universitario.').addTo(hospitals),
L.marker([39.477792, -0.401291]).addTo(map).bindPopup('Hospital 9 de Octubre.').addTo(hospitals),
L.marker([39.453241, -0.394478]).addTo(map).bindPopup('<b>HOSPITAL PESET ALEXANDER.</b><br> PRE: 4.9 - PRO: 4.9 - xHL7.WS: 4.9 - EPAT: 4.03').addTo(hospitals),
L.marker([39.443399, -0.376024]).addTo(map).bindPopup('<b>HOSPITAL UNIVERSITARI I POLITECNIC LA FE </b><br> PRE: 4.9 - PRO: 4.9 - xHL7.WS: 4.9 - EPAT: 4.03').addTo(hospitals),
L.marker([39.159343, -0.415893]).addTo(map).bindPopup('<b>HOSPITAL DE LA RIVERA</b>').addTo(hospitals),
L.marker([39.006439, -0.509448]).addTo(map).bindPopup('<b>HOSPITAL LLUIS ALCANYIS DE XATIVA</b><br> PRE: 4.9 - PRO: 4.9 - xHL7.WS: no - EPAT: 4.03').addTo(hospitals),
L.marker([38.962906, -0.169687]).addTo(map).bindPopup('<b>HOSPITAL FRANCESC DE BORJA DE GANDIA </b><br> PRE: 4.9 - PRO: 4.9 - xHL7.WS: 4.9 - EPAT: 4.03').addTo(hospitals),
L.marker([38.819943, -0.603304]).addTo(map).bindPopup('HOSPITAL GENERAL ONTINYENT.').addTo(hospitals),
L.marker([38.705086, -0.465642]).addTo(map).bindPopup('<b>HOSPITAL VIRGEN DE LOS LIRIOS DE ALCOI </b><br> PRE: 4.9 - PRO: 4.9 - xHL7.WS: no - EPAT: 4.03').addTo(hospitals),
L.marker([38.833484, 0.05918]).addTo(map).bindPopup('Hospital de Denia.').addTo(hospitals),
L.marker([38.827937, 0.096302]).addTo(map).bindPopup('Hospital La Pedrera.').addTo(hospitals),
L.marker([38.504711, -0.237011]).addTo(map).bindPopup('<b>HOSPITAL MARINA BAIXA DE LA VILA JOIOSA.</b><br> PRE: 4.9 - PRO: 4.9 - xHL7.WS: no - EPAT: 4.03').addTo(hospitals),
L.marker([38.477757, -0.798225]).addTo(map).bindPopup('<b>HOSPITAL VIRGEN DE LA SALUD DE ELDA </b><br> PRE: 4.11 - PRO: 4.11- xHL7.WS: 4.11 - EPAT: 4.11').addTo(hospitals),
L.marker([38.403335, -0.530713]).addTo(map).bindPopup('Hospital San Vicente del Raspell.').addTo(hospitals),
L.marker([38.344312, -0.495715]).addTo(map).bindPopup('<b>HOSPITAL GENERAL DE ALICANTE</b><br> PRE: 4.9 - PRO: 4.9 - xHL7.WS: no - EPAT: 4.03').addTo(hospitals),
L.marker([38.388543, -0.434346]).addTo(map).bindPopup('<b>HOSPITAL SAN JUAN DE ALICANTE </b><br> PRE: 4.9 - PRO: 4.9 - xHL7.WS: no - EPAT: 4.03').addTo(hospitals),
L.marker([38.255366, -0.716021]).addTo(map).bindPopup('Hospital Elx-Vinalopó').addTo(hospitals),
L.marker([38.259723, -0.685347]).addTo(map).bindPopup('<b>HOSPITAL GENERAL DE ELX / ELCHE </b><br> PRE: 4.9 - PRO: 4.9 - xHL7.WS: 4.11 - EPAT: 4.03').addTo(hospitals),
L.marker([38.086437, -0.951144]).addTo(map).bindPopup('<b>HOSPITAL VEGA BAJA DE ORIHUELA </b><br> PRE: 4.11 - PRO: 4.11 - xHL7.WS: 4.9 - EPAT: 4.03').addTo(hospitals),
L.marker([38.006112, -0.657227]).addTo(map).bindPopup('<b>Hospital Torrevieja').addTo(hospitals);
// HL7 PETICION / RESULTADOS --> xHL7
// control that shows state info on hover
var info = L.control();
info.onAdd = function (map) {
this._div = L.DomUtil.create('div', 'info');
this.update();
return this._div;
};
info.update = function (props) {
this._div.innerHTML = '<h4>COVID 19 - Abril 2020</h4>' + (props ?
'<b>' + props.name + '</b><br/>' +
'casos Covid: ' + props.usu_t + '<br/>' +
'Población: ' + props.t_inf
: 'Ubique el ratón sobre un departamento');
};
info.addTo(map);
function getColor(d) {
return d > 100000 ? '#800026' :
d > 750 ? '#BD0026' :
d > 625 ? '#E31A1C' :
d > 500 ? '#FC4E2A' :
d > 375 ? '#FD8D3C' :
d > 250 ? '#FEB24C' :
d > 100 ? '#FED976' :
'#3182BD';
}
function style(feature) {
return {
weight: 2,
opacity: 1,
color: 'white',
dashArray: '3',
fillOpacity: 0.5,
fillColor: getColor(feature.properties.usu_t)
};
}
function highlightFeature(e) {
var layer = e.target;
layer.setStyle({
weight: 5,
color: '#666',
dashArray: '',
fillOpacity: 0.7
});
if (!L.Browser.ie && !L.Browser.opera && !L.Browser.edge) {
layer.bringToFront();
}
info.update(layer.feature.properties);
}
var geojson;
function resetHighlight(e) {
geojson.resetStyle(e.target);
info.update();
}
function zoomToFeature(e) {
map.fitBounds(e.target.getBounds());
}
function onEachFeature(feature, layer) {
layer.on({
mouseover: highlightFeature,
mouseout: resetHighlight,
click: zoomToFeature
});
}
geojson = L.geoJson(statesData, {
style: style,
onEachFeature: onEachFeature
}).addTo(map);
map.attributionControl.addAttribution('PATWIN © <a href="http://www.san.gva.es">');
var legend = L.control({position: 'bottomright'});
legend.onAdd = function (map) {
var div = L.DomUtil.create('div', 'info legend'),
grades = [0, 125, 250, 375, 500, 625, 750, 875],
labels = ["Nº casos CoVid "],
from, to;
for (var i = 0; i < grades.length; i++) {
from = grades[i];
to = grades[i + 1];
labels.push(
'<i style="background:' + getColor(from + 1) + '"></i> ' +
from + (to ? '–' + to : '+'));
}
div.innerHTML = labels.join('<br>');
return div;
};
legend.addTo(map);
</script>
</body>
</html>