diff --git a/.gitignore b/.gitignore index f47c021..1c5f384 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +www/dlsv www/event.xml www/geolocation.js www/stations.xml diff --git a/www/events.js b/www/events.js index 504fa91..1cfee10 100644 --- a/www/events.js +++ b/www/events.js @@ -50,24 +50,29 @@ function getGeolocation(id, lat, lng) { }; /* Load events using ajax */ -function ajaxLoadEvents(stime, etime) { - var request_data = {}; - if ( !stime ) { - stime = new Date(); - stime.setDate(stime.getDate()-config['map']['timespan']); - }; +function ajaxLoadEvents(stime, etime, id) { var mapBounds = map.getBounds(); - request_data = { - starttime: sprintf("%d-%02d-%02d", stime.getFullYear(), stime.getMonth()+1, stime.getDate()), - orderby: 'time-asc', - minlat: sprintf('%.2f', mapBounds.getSouth()-config['map']['latlngDelta']), - maxlat: sprintf('%.2f', mapBounds.getNorth()+config['map']['latlngDelta']), - minlon: sprintf('%.2f', mapBounds.getWest()-config['map']['latlngDelta']), - maxlon: sprintf('%.2f', mapBounds.getEast()+config['map']['latlngDelta']), - minmag: sprintf('%.1f', config['event']['minMag']-config['event']['minMagDelta']), - }; - if ( etime ) { - request_data['endtime'] = sprintf("%d-%02d-%02d", etime.getFullYear(), etime.getMonth()+1, etime.getDate()); + var request_data = {}; + if ( id ) { + if ( id == 'bug2014jptq' ) console.log('Loading special event '+id); + request_data = { eventid: id }; + } else { + if ( !stime ) { + stime = new Date(); + stime.setDate(stime.getDate()-config['map']['timespan']); + }; + request_data = { + starttime: sprintf("%d-%02d-%02d", stime.getFullYear(), stime.getMonth()+1, stime.getDate()), + orderby: 'time-asc', + minlat: sprintf('%.2f', mapBounds.getSouth()-config['map']['latlngDelta']), + maxlat: sprintf('%.2f', mapBounds.getNorth()+config['map']['latlngDelta']), + minlon: sprintf('%.2f', mapBounds.getWest()-config['map']['latlngDelta']), + maxlon: sprintf('%.2f', mapBounds.getEast()+config['map']['latlngDelta']), + minmag: sprintf('%.1f', config['event']['minMag']-config['event']['minMagDelta']), + }; + if ( etime ) { + request_data['endtime'] = sprintf("%d-%02d-%02d", etime.getFullYear(), etime.getMonth()+1, etime.getDate()); + }; }; $.ajax({ type: "GET", @@ -87,10 +92,12 @@ function ajaxLoadEvents(stime, etime) { var type = $(this).find('type').last().text(); var location // get location, try this in order: - // cached value, nominatim lookup, regional map name, or given value - location = geolocationTable[id] || getGeolocation(id, lat, lng) || getLocation(lat, lng)[0] || $(this).find('description > text').text(); + // regional map name, given value, cached value, or nominatim lookup + location = ( getLocation(lat, lng)[0] || $(this).find('description > text').text() ); + location = ( geolocationTable[id] || getGeolocation(id, lat, lng) ); // create table row: Date, Time, Mag, Location if ( !eventTable[id] && $.inArray(type, config['event']['typeWhitelist'] )+1 && $.inArray(evaluationStatus, config['event']['evaluationBlacklist'])<0 && Number(mag)+0.05 >= config['event']['minMag'] ) { + if ( id == 'bug2014jptq' ) console.log('Adding row for special event '+id); // general event info (1st line) var row = '
Download als CSV
diff --git a/www/map.js b/www/map.js index 2cf0d28..19f578c 100644 --- a/www/map.js +++ b/www/map.js @@ -42,25 +42,32 @@ function addStationMarker(id, lat, lng, station) { /* add event marker */ function addEventMarker(id, lat, lng, mag) { - var markerOptions = { - gradient: true, - dropShadow: false, - fillColor: config['event']['markerColor'], - fillOpacity: config['event']['markerOpacity'], - color: config['event']['markerColor'], - weight: 0, - opacity: 1, - className: id+' eventMarker', - radius: mag2radius(mag) + if ( id == 'bug2014jptq' ) console.log('Adding marker for special event '+id); + if ( eventTable[id] ) { + return eventTable[id]; + console.log('Marker allready exists ID: '+id); + } else { + var markerOptions = { + gradient: true, + dropShadow: false, + fillColor: config['event']['markerColor'], + fillOpacity: config['event']['markerOpacity'], + color: config['event']['markerColor'], + weight: 0, + opacity: 1, + className: id+' eventMarker', + radius: mag2radius(mag) + }; + var marker = L.circleMarker(L.latLng(lat, lng), markerOptions); + eventLayer.addLayer(marker); + eventTable[id] = marker; + return marker; }; - var marker = L.circleMarker(L.latLng(lat, lng), markerOptions); - eventLayer.addLayer(marker); - eventTable[id] = marker; - return marker; }; /* handle to show events on map */ function initMapLink() { + $("#eventstable > tbody > tr > td > a.map-link").off('click'); $("#eventstable > tbody > tr > td > a.map-link").on('click' , function(){ var highlightStyle = { color: config['event']['markerColorH'], @@ -89,15 +96,15 @@ function initMapLink() { if ( $(this).hasClass('selected') ) { $(this).removeClass('selected'); $(this).text('Karte'); - eventTable[$(this).attr('eventid')].setStyle(normalStyle); map.setView(config['map']['centerDefault'], config['map']['zoomDefault']); + eventTable[$(this).attr('eventid')].setStyle(normalStyle); highlightFirstEvent(); // unselected -> selected } else { $(this).addClass('selected'); $(this).text('im Fokus (rot)'); - eventTable[$(this).attr('eventid')].setStyle(highlightStyle); map.setView(eventTable[$(this).attr('eventid')].getLatLng(), config['map']['zoomFocus']); + eventTable[$(this).attr('eventid')].setStyle(highlightStyle) }; }); return false; @@ -116,6 +123,12 @@ $(document).ready(function() { // create baselayer switch ( config['map']['baselayer'] ) { + case 'osmde': // add OpenStreetMap.DE tile layer + L.tileLayer('http://{s}.tile.openstreetmap.de/tiles/osmde/{z}/{x}/{y}.png', + { + attribution: '© OpenStreetMap contributors, CC-BY-SA', + }).addTo(map); + break; case 'esrigray': // add ESRI Grayscale World Map (neither city nor road names) L.tileLayer('//server.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Base/MapServer/tile/{z}/{y}/{x}', { @@ -123,6 +136,12 @@ $(document).ready(function() { maxZoom: 16 }).addTo(map); break; + case 'aerial': // add ESRI WordImagery tile layer + L.tileLayer('http://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}', + { + attribution: 'Tiles © Esri — Source: Esri, i-cubed, USDA, USGS, AEX, GeoEye, Getmapping, Aerogrid, IGN, IGP, UPR-EGP, and the GIS User Community' + }).addTo(map); + break; case 'mapquestgray': // add MapQuestOSM tile layer L.tileLayer.grayscale('http://otile{s}.mqcdn.com/tiles/1.0.0/map/{z}/{x}/{y}.jpg', { @@ -150,6 +169,8 @@ $(document).ready(function() { // load events ajaxLoadEvents(); + //ajaxLoadEvents([], [], ['bug2014jptq', 'gfz2013yvko']); + ajaxLoadEvents([], [], 'bug2014jptq'); toggleFilteredMarkers(); // bind popupopen event diff --git a/www/misc.js b/www/misc.js index dfb20fa..61849c0 100644 --- a/www/misc.js +++ b/www/misc.js @@ -92,6 +92,7 @@ var config = { ajax: { timeout: 10000, // 10 seconds eventURL: 'https://ariadne.geophysik.ruhr-uni-bochum.de/fdsnws/event/1/query', + dlsvURL: 'dlsv', mseedURL: 'https://ariadne.geophysik.ruhr-uni-bochum.de/fdsnws/dataselect/1/query', stationURL: 'https://ariadne.geophysik.ruhr-uni-bochum.de/fdsnws/station/1/query', nominatimURL: '//open.mapquestapi.com/nominatim/v1/reverse.php', @@ -121,11 +122,27 @@ var config = { GE_IBBN: 10, GR_BUG: 10, GR_KAST: 10, + NL_HGN: 3, NL_OPLO: 3, + NL_VKB: 3, + NL_WIT: 3, NL_WTSB: 3, }, + networkBlacklist: ['NL', 'X5'], }, }; +var networkURL = { + GE: 'http://dx.doi.org/10.14470/TR560404', + GR: 'http://www.bgr.bund.de/DE/Themen/Erdbeben-Gefaehrdungsanalysen/Seismologie/Seismologie/Seismometer_Stationen/Stationsnetze/d_stationsnetz_node.html', + NL: 'http://www.knmi.nl/seismologie/seismisch_network_knmi3.html', +}; +var networkText = { + GE: 'GEOFON Program, GFZ Potsdam', + GR: 'German Regional Seismic Network, BGR Hannover', + NL: 'Netherlands Seismic Network, The Netherlands', + RN: 'RuhrNet - Ruhr-University Bochum, Germany', +}; +var bochumStation = ['BUG', 'IBBN', 'KERA', 'KARP']; /********************************************************************** * document ready * @@ -136,6 +153,9 @@ $(document).ready(function() { if ( parameters['baselayer'] ) { config['map']['baselayer'] = parameters['baselayer'][0]; }; + if ( Number(parameters['lat']) && Number(parameters['lon']) ) { + config['map']['centerDefault'] = [Number(parameters['lat']), Number(parameters['lon'])]; + }; if ( Number(parameters['minmag']) ) { config['event']['minMag'] = Number(parameters['minmag']); }; @@ -162,6 +182,7 @@ $(document).ready(function() { var tabOptions = { active: 0, disabled: [2, 3], + activate: function( event, ui ) { ui['newPanel'].find('table').trigger("update", [true]); }, }; $('#tabs').tabs(tabOptions); }); diff --git a/www/stations.js b/www/stations.js index 33c7f2b..f9d5d36 100644 --- a/www/stations.js +++ b/www/stations.js @@ -40,6 +40,7 @@ function loadStations(stime, etime) { var request_data = { endafter: sprintf("%d-%02d-%02d", stime.getFullYear(), stime.getMonth()+1, stime.getDate()), startbefore: sprintf("%d-%02d-%02d", etime.getFullYear(), etime.getMonth()+1, etime.getDate()), + level: 'station', minlat: S-config['map']['latlngDelta'], maxlat: N+config['map']['latlngDelta'], minlon: W-config['map']['latlngDelta'], @@ -53,19 +54,46 @@ function loadStations(stime, etime) { success: function (xml) { $(xml).find('Network').each(function () { var network = $(this).attr('code'); - $(this).find('Station').each(function () { - var station = $(this).attr('code'), - lat = $(this).find('Latitude').text(), - lng = $(this).find('Longitude').text(), - stationID = network+'_'+station, - stationText = network+'.'+station; - if ( !stationTable[stationID] ) { // && N >= lat && S <= lat && W<= lng && E >= lng - var row = sprintf('