";
else if (item.ispast) {
content += "
";
pastsuffix = "_past";
}
else
content += "
";
content += "
";
content += "
";
content += " " + item.title;
content += "
";
content += "
";
content += " ";
content += " " + item.subtitle;
content += " ";
content += " ";
content += " - " + item.datestring;
content += " ";
content += "
";
content += "
";
content += " ";
});
content += "
";
$("#" + hazard + "disaster").html(content);
});
}
else {
$.each(hazards, function (h, hazard) {
$("#" + hazard + "disaster").html("");
});
}
},
error: function (response) {
$.each(hazards, function (h, hazard) {
$("#" + hazard + "disaster").html("");
});
}
});
}
$(function () {
CreateHazardTable();
var neq = countRows("#mainListEq");
var ntc = countRows("#mainListTc");
var nfl = countRows("#mainListFl");
var nvo = countRows("#mainListVo");
var ndr = countRows("#mainListDr");
var nwf = countRows("#mainListWF");
var w = window.innerWidth;
if (w = 0 || finalUrl.indexOf("[mm]") >= 0 || finalUrl.indexOf("[dd]") >= 0) {
finalUrl = finalUrl.replace("[yyyy]", stepDate.getFullYear().toString()).
replace("[mm]", (stepDate.getMonth() + 101).toString().substr(1, 2)).
replace("[dd]", (stepDate.getDate() + 100).toString().substr(1, 2));
}
return new ol.source.Vector({
url: finalUrl.replace("[yyyy]", stepDate.getFullYear().toString()).
replace("[mm]", (stepDate.getMonth() + 101).toString().substr(1, 2)).
replace("[dd]", (stepDate.getDate() + 100).toString().substr(1, 2)),
format: new ol.format.KML()
});
}
function setSourceClouds() {
var finalUrl = maskCloudUrl;
while (finalUrl.indexOf("[yyyy]") >= 0 || finalUrl.indexOf("[mm]") >= 0 || finalUrl.indexOf("[dd]") >= 0) {
finalUrl = finalUrl.replace("[yyyy]", stepDate.getFullYear().toString()).
replace("[mm]", (stepDate.getMonth() + 101).toString().substr(1, 2)).
replace("[dd]", (stepDate.getDate() + 100).toString().substr(1, 2));
}
return new ol.source.ImageStatic({
url: finalUrl.replace("[yyyy]", stepDate.getFullYear().toString()).
replace("[mm]", (stepDate.getMonth() + 101).toString().substr(1, 2)).
replace("[dd]", (stepDate.getDate() + 100).toString().substr(1, 2)),
projection: 'EPSG:4326',
imageExtent: [-180, -90, 180, 90]
})
}
function setSourceRain() {
var finalUrl = maskRainUrl;
while (finalUrl.indexOf("[yyyy]") >= 0 || finalUrl.indexOf("[mm]") >= 0 || finalUrl.indexOf("[dd]") >= 0) {
finalUrl = finalUrl.replace("[yyyy]", stepDate.getFullYear().toString()).
replace("[mm]", (stepDate.getMonth() + 101).toString().substr(1, 2)).
replace("[dd]", (stepDate.getDate() + 100).toString().substr(1, 2));
}
return new ol.source.ImageStatic({
url: finalUrl.replace("[yyyy]", stepDate.getFullYear().toString()).
replace("[mm]", (stepDate.getMonth() + 101).toString().substr(1, 2)).
replace("[dd]", (stepDate.getDate() + 100).toString().substr(1, 2)),
projection: 'EPSG:4326',
imageExtent: [-180, -90, 180, 90]
})
}
function setSourceGfds() {
var finalUrl = maskGfdsUrl;
while (finalUrl.indexOf("[yyyy]") >= 0 || finalUrl.indexOf("[mm]") >= 0 || finalUrl.indexOf("[dd]") >= 0) {
finalUrl = finalUrl.replace("[yyyy]", stepDate.getFullYear().toString()).
replace("[mm]", (stepDate.getMonth() + 101).toString().substr(1, 2)).
replace("[dd]", (stepDate.getDate() + 100).toString().substr(1, 2));
}
return new ol.source.ImageStatic({
url: finalUrl,
projection: 'EPSG:4326',
imageExtent: [-180, -90, 180, 90]
})
}
function getVectorModis() {
return new ol.layer.Vector({
id: 'Modis',
title: 'Modis',
source: setSourceModis()
});
}
function chooseLayer() {
//layerList.push(clouds_WMS);
layerList.push(rain_WMS);
layerList.push(dr_Buffer);
layerList.push(vo_Buffer);
layerList.push(fl_Buffer);
layerList.push(wf_Buffer);
layerList.push(tc_Buffer);
layerList.push(eq_Buffer);
layerList.push(vosocc_Buffer);
return layerList;
}
var rainLegend = "
OpenStreetMapThe boundaries and the names shown on this map do not imply official endorsement or acceptance by the European Union.
";
var rainLegend1 = "
OpenStreetMapThe boundaries and the names shown on this map do not imply official endorsement or acceptance by the European Union.
";
var scaleLineControl = new ol.control.ScaleLine();
scaleLineControl.setUnits('metric');
function buildMap() {
return new ol.Map({
controls: ol.control.defaults().extend([
scaleLineControl
]),
target: 'map',
overlays: [overlay],
layers: [
new ol.layer.Group({
id: 'Base',
title: 'Base maps',
layers: [
new ol.layer.Tile({
title: 'JRC - OSM',
id: 'osmec',
last: false,
type: 'base',
visible: false,
source: new ol.source.XYZ({
projection: 'EPSG:3857',
//projection: 'EPSG:900913',
//url: "https://europa.eu/webtools/maps/tiles/osm-ec/{z}/{x}/{y}.png",
url: "https://gisco-services.ec.europa.eu/maps/tiles/OSMCartoComposite/EPSG3857/{z}/{x}/{y}.png",
attributions: [new ol.Attribution({ html: "
OpenStreetMapThe boundaries and the names shown on this map do not imply official endorsement or acceptance by the European Union." })],
maxZoom: 18,
})
}),
new ol.layer.Tile({
title: 'JRC - Hypso',
id: 'hypsoec',
type: 'base',
last: false,
visible: true,
source: new ol.source.XYZ({
//url: "https://europa.eu/webtools/maps/tiles/hypso/{z}/{x}/{y}",
projection: 'EPSG:3857',
url: "https://gisco-services.ec.europa.eu/maps/tiles/Hypsometric/EPSG3857/{z}/{x}/{y}.png",
maxZoom: 6
})
}),
new ol.layer.Tile({
title: 'JRC - Natural',
id: 'naturalec',
type: 'base',
last: false,
visible: false,
source: new ol.source.XYZ({
//url: "https://europa.eu/webtools/maps/tiles/natural/{z}/{x}/{y}",
projection: 'EPSG:3857',
url: "https://gisco-services.ec.europa.eu/maps/tiles/NaturalEarth/EPSG3857/{z}/{x}/{y}.png",
maxZoom: 6
})
}),
new ol.layer.Tile({
title: 'JRC - Bmarble',
id: 'bmarbleec',
type: 'base',
last: false,
visible: false,
source: new ol.source.XYZ({
//url: "https://europa.eu/webtools/maps/tiles/bmarble/{z}/{x}/{y}",
projection: 'EPSG:3857',
url: "https://gisco-services.ec.europa.eu/maps/tiles/BlueMarble/EPSG3857/{z}/{x}/{y}.png",
maxZoom: 9
})
})
]
}),
new ol.layer.Group({
id: 'Layers',
title: 'Layers',
layers: chooseLayer()
})
],
view: new ol.View({
center: [30, 0],
zoom: 1.8,
projection: 'EPSG:4326',
minZoom: 1,
maxZoom: 11
})
});
}
function onMoveEnd(evt) {
var map = evt.map;
zoomLevel = map.getView().getZoom();
var all_layer_groups = map.getLayers();
var layer_group;
var layer_item;
var all_layer_gdacs;
for (i = 0, n = all_layer_groups.getLength(); i = 7) {
if (layer_item.get('id') == 'osmec') {
idxOsm = j;
}
layer_item.set('visible', false);
}
else {
if (layer_item.get('choosed') == true) {
idxOsm = j;
}
layer_item.set('visible', false);
}
}
if (idxOsm > -1) {
layer_item = all_layer_gdacs.item(idxOsm);
layer_item.set('visible', true);
}
}//if
}//for
map.updateSize();
map.render();
}
function onSingleClick(evt) {
var coordinate = evt.coordinate;
var pixel = evt.pixel;
var _found = false;
evt.map.forEachFeatureAtPixel(pixel, function (feature, layer) {
// check the layer property, if it is not set then it means we
// are over an OverlayFeature and we can ignore this feature
if (!layer || _found) {
return;
}
// test the feature's geometry type and compute a reasonable point
// at which to display the text.
var geometry = feature.getGeometry();
var point;
switch (geometry.getType()) {
case 'MultiPolygon':
var poly = geometry.getPolygons().reduce(function (left, right) {
return left.getArea() > right.getArea() ? left : right;
});
point = poly.getInteriorPoint().getCoordinates();
break;
case 'Polygon':
point = geometry.getInteriorPoint().getCoordinates();
break;
default:
point = geometry.getClosestPoint(coordinate);
}
// create a new feature to display the text
/*textFeature = new ol.Feature({
geometry: new ol.geom.Point(point),
text: feature.get('name'),
isoCode: feature.get('iso_a2').toLowerCase()
});*/
// and add it to the featureOverlay. Also add the feature itself
// so the country gets outlined
if (feature.get('Class') == 'Point_Centroid') {
var reportLink = feature.get('link');
var magnitudeReference = '';
if (reportLink == null)
reportLink = feature.get('url').report;
if (feature.get('eventtype') == 'EQ') {
if (feature.get('severity') != null)
magnitudeReference = ' M ' + feature.get('severity') + ' ';
else
magnitudeReference = ' M ' + feature.get('severitydata').severity + ' ';
}
if (reportLink != null && reportLink != '') {
//content.innerHTML = '';
content.innerHTML = '
' +
'
' + feature.get('alertlevel') + magnitudeReference + ' ' + feature.get('description') + '
' +
'
' + feature.get('todate') + '
' +
'
Full report here
' +
'
';
}
else {
content.innerHTML = '
' +
'
' + feature.get('alertlevel') + magnitudeReference + ' ' + feature.get('description') + '
' +
'
' + feature.get('todate') + '
' +
'
';
}
overlay.setPosition(coordinate);
_found = true;
}
});
}
function buildLayerSwitcher() {
return new ol.control.LayerSwitcher({
tipLabel: 'Layers' // Optional label for button
});
}
function buildLayerLegend() {
return new ol.control.LayerLegend({
tipLabel: 'Legend' // Optional label for button
},
'https://www.gdacs.org/images/rainfall_legend.png');
}
var layerSwitcher = buildLayerSwitcher()
var layerLegend = buildLayerLegend()
var map = buildMap();
function addMapController() {
map.addControl(layerSwitcher);
map.addControl(layerLegend);
map.on('singleclick', onSingleClick);
map.on('moveend', onMoveEnd);
return true;
}
addMapController();
var setTime = function () {
//stepDate.setDate(stepDate.getDate() + 1);
if (stepDate > endDate)
stepDate = new Date(startDate);
//map = buildMap();
//addMapController();
var all_layer_groups = map.getLayers();
var layer_group;
var layer_item;
var all_layer_gdacs;
for (i = 0, n = all_layer_groups.getLength(); i