From
To
Level
Severity
Country
The SEARCH function returns at most 100 events
"; var rainLegend1 = "

OpenStreetMap
The 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: 'OSM JRC', id: 'osmec', type: 'base', visible: true, source: new ol.source.XYZ({ //projection: 'EPSG:900913', //url: "//europa.eu/webtools/maps/tiles/osm-ec/{z}/{x}/{y}.png", projection: 'EPSG:3857', url: "https://gisco-services.ec.europa.eu/maps/tiles/OSMCartoComposite/EPSG3857/{z}/{x}/{y}.png", attributions: [new ol.Attribution({ html: "OpenStreetMap
The 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', visible: false, source: new ol.source.XYZ({ url: "https://europa.eu/webtools/maps/tiles/hypso/{z}/{x}/{y}", maxZoom: 18 }) }), new ol.layer.Tile({ title: 'JRC - Natural', id: 'naturalec', type: 'base', visible: false, source: new ol.source.XYZ({ url: "https://europa.eu/webtools/maps/tiles/natural/{z}/{x}/{y}", maxZoom: 18 }) }), new ol.layer.Tile({ title: 'JRC - Bmarble', id: 'bmarbleec', type: 'base', visible: false, source: new ol.source.XYZ({ url: "https://europa.eu/webtools/maps/tiles/bmarble/{z}/{x}/{y}", maxZoom: 18 }) })] }), new ol.layer.Group({ id: 'Layers', title: 'Layers', layers: chooseLayer() }) ], view: new ol.View({ center: [0, 0], zoom: 2, projection: 'EPSG:4326', minZoom: 1, maxZoom: 11 }) }); } function onMoveEnd(evt) { var map = evt.map; zoomLevel = map.getView().getZoom(); } 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 var reportLink = feature.get('link'); var magnitudeReference = ''; if (reportLink == null) reportLink = feature.get('url').report; if (feature.get('eventtype') == 'EQ') magnitudeReference = ' M ' + feature.get('severitydata').severity + ' '; if (reportLink != null && reportLink != '') { //content.innerHTML = '
' + feature.get('htmldescription') + '
see full report here
'; 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 changeLayer = function () { //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