Added support for special events. use different markers for EQ, quarry blast or induced events.
This commit is contained in:
parent
873a21f539
commit
8d8e0c5ff7
Notes:
subgit
2018-03-07 17:58:57 +01:00
r661 www/trunk
@ -22,6 +22,22 @@
|
|||||||
$Id$
|
$Id$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/* adding row(s) to a table and format date strings afterwards */
|
||||||
|
function addTableRow(row, table) {
|
||||||
|
var added = $('#'+table+' tbody').append(row);
|
||||||
|
added.find('.tablesorter-childRow td').hide();
|
||||||
|
$('#'+table).find('td.utctime-date').each(function() {
|
||||||
|
$.localtime.formatObject($(this), "dd.MM.yyyy");
|
||||||
|
$(this).removeClass('utctime-date');
|
||||||
|
$(this).addClass('localtime-date');
|
||||||
|
});
|
||||||
|
$('#'+table).find('td.utctime-time').each(function() {
|
||||||
|
$.localtime.formatObject($(this), "HH:mm");
|
||||||
|
$(this).removeClass('utctime-time');
|
||||||
|
$(this).addClass('localtime-time');
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
/* do reverse geolocation lookup */
|
/* do reverse geolocation lookup */
|
||||||
function getGeolocation(id, lat, lng) {
|
function getGeolocation(id, lat, lng) {
|
||||||
if ( !geolocationTable[id] ) {
|
if ( !geolocationTable[id] ) {
|
||||||
@ -50,17 +66,16 @@ function getGeolocation(id, lat, lng) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/* Load events using ajax */
|
/* Load events using ajax */
|
||||||
function ajaxLoadEvents(stime, etime, id) {
|
function ajaxLoadEvents(stime, etime, id, target) {
|
||||||
var mapBounds = map.getBounds();
|
var mapBounds = map.getBounds();
|
||||||
var request_data = {};
|
var request_data = {};
|
||||||
|
if ( stime == '' || !stime ) {
|
||||||
|
stime = new Date();
|
||||||
|
stime.setDate(stime.getDate()-config['map']['timespan']);
|
||||||
|
};
|
||||||
if ( id ) {
|
if ( id ) {
|
||||||
if ( id == 'bug2014jptq' ) console.log('Loading special event '+id);
|
|
||||||
request_data = { eventid: id };
|
request_data = { eventid: id };
|
||||||
} else {
|
} else {
|
||||||
if ( !stime ) {
|
|
||||||
stime = new Date();
|
|
||||||
stime.setDate(stime.getDate()-config['map']['timespan']);
|
|
||||||
};
|
|
||||||
request_data = {
|
request_data = {
|
||||||
starttime: sprintf("%d-%02d-%02d", stime.getFullYear(), stime.getMonth()+1, stime.getDate()),
|
starttime: sprintf("%d-%02d-%02d", stime.getFullYear(), stime.getMonth()+1, stime.getDate()),
|
||||||
orderby: 'time-asc',
|
orderby: 'time-asc',
|
||||||
@ -74,6 +89,7 @@ function ajaxLoadEvents(stime, etime, id) {
|
|||||||
request_data['endtime'] = sprintf("%d-%02d-%02d", etime.getFullYear(), etime.getMonth()+1, etime.getDate());
|
request_data['endtime'] = sprintf("%d-%02d-%02d", etime.getFullYear(), etime.getMonth()+1, etime.getDate());
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
if ( etime == '' || !etime ) { etime = new Date(); };
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: "GET",
|
type: "GET",
|
||||||
url: config['ajax']['eventURL'],
|
url: config['ajax']['eventURL'],
|
||||||
@ -97,7 +113,6 @@ function ajaxLoadEvents(stime, etime, id) {
|
|||||||
location = ( geolocationTable[id] || getGeolocation(id, lat, lng) );
|
location = ( geolocationTable[id] || getGeolocation(id, lat, lng) );
|
||||||
// create table row: Date, Time, Mag, Location
|
// 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 ( !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)
|
// general event info (1st line)
|
||||||
var row = '<tr class="tablesorter-hasChildRow">'
|
var row = '<tr class="tablesorter-hasChildRow">'
|
||||||
+ '<td class="utctime-date">'+otime.split('.')[0]+'Z</td>'
|
+ '<td class="utctime-date">'+otime.split('.')[0]+'Z</td>'
|
||||||
@ -111,28 +126,22 @@ function ajaxLoadEvents(stime, etime, id) {
|
|||||||
// setting up download links (3nd line)
|
// setting up download links (3nd line)
|
||||||
var xmlurl = sprintf('%s?formatted=true&includearrivals=true&eventid=%s', config['ajax']['eventURL'], id);
|
var xmlurl = sprintf('%s?formatted=true&includearrivals=true&eventid=%s', config['ajax']['eventURL'], id);
|
||||||
var oTime = new Date(otime);
|
var oTime = new Date(otime);
|
||||||
var stime = new Date(oTime.getTime()-10*1000.-oTime.getMilliseconds());
|
var sTime = new Date(oTime.getTime()-10*1000.-oTime.getMilliseconds());
|
||||||
var etime = new Date(oTime.getTime()+50*1000.-oTime.getMilliseconds());
|
var eTime = new Date(oTime.getTime()+50*1000.-oTime.getMilliseconds());
|
||||||
var mseedurl = sprintf('%s?net=GE,GR,RN&cha=EH?,HH?&start=%04d-%02d-%02dT%02d:%02d:%02d&end=%04d-%02d-%02dT%02d:%02d:%02d', config['ajax']['mseedURL'], Number(stime.getUTCFullYear()), Number(stime.getUTCMonth())+1, Number(stime.getUTCDate()), Number(stime.getUTCHours()), Number(stime.getUTCMinutes()), Number(stime.getUTCSeconds()), Number(etime.getUTCFullYear()), Number(etime.getUTCMonth())+1, Number(etime.getUTCDate()), Number(etime.getUTCHours()), Number(etime.getUTCMinutes()), Number(etime.getUTCSeconds()));
|
var mseedurl = sprintf('%s?net=GE,GR,RN&cha=EH?,HH?&start=%04d-%02d-%02dT%02d:%02d:%02d&end=%04d-%02d-%02dT%02d:%02d:%02d', config['ajax']['mseedURL'], Number(sTime.getUTCFullYear()), Number(sTime.getUTCMonth())+1, Number(sTime.getUTCDate()), Number(sTime.getUTCHours()), Number(sTime.getUTCMinutes()), Number(sTime.getUTCSeconds()), Number(eTime.getUTCFullYear()), Number(eTime.getUTCMonth())+1, Number(eTime.getUTCDate()), Number(eTime.getUTCHours()), Number(eTime.getUTCMinutes()), Number(eTime.getUTCSeconds()));
|
||||||
row += '<tr class="tablesorter-childRow event-download">'
|
row += '<tr class="tablesorter-childRow event-download">'
|
||||||
+ '<td colspan="4" eventid="'+id+'">'
|
+ '<td colspan="4" eventid="'+id+'">'
|
||||||
+ sprintf('Download <a class="xml-link" target="_blank" href="%s">QuakeML</a> or <a class="mseed-link" target="_blank" href="%s">miniSEED</a>', xmlurl, mseedurl)
|
+ sprintf('Download <a class="xml-link" target="_blank" href="%s">QuakeML</a> or <a class="mseed-link" target="_blank" href="%s">miniSEED</a>', xmlurl, mseedurl)
|
||||||
+ '</td></tr>';
|
+ '</td></tr>';
|
||||||
// add row to table
|
// add row to table
|
||||||
var added = $('#eventstable tbody').append(row);
|
if ( stime <= oTime && etime >= oTime ) {
|
||||||
added.find('.tablesorter-childRow td').hide();
|
addTableRow(row, 'eventstable');
|
||||||
$('#eventstable').find('td.utctime-date').each(function() {
|
};
|
||||||
$.localtime.formatObject($(this), "dd.MM.yyyy");
|
if ( target ) {
|
||||||
$(this).removeClass('utctime-date');
|
addTableRow(row, target);
|
||||||
$(this).addClass('localtime-date');
|
}
|
||||||
});
|
|
||||||
$('#eventstable').find('td.utctime-time').each(function() {
|
|
||||||
$.localtime.formatObject($(this), "HH:mm");
|
|
||||||
$(this).removeClass('utctime-time');
|
|
||||||
$(this).addClass('localtime-time');
|
|
||||||
});
|
|
||||||
// create marker
|
// create marker
|
||||||
var marker = addEventMarker(id, Number(lat), Number(lng), Number(mag));
|
var marker = addEventMarker(id, Number(lat), Number(lng), Number(mag), type);
|
||||||
var text = sprintf('<h3 eventid="%s">%s</h3>', id, location)
|
var text = sprintf('<h3 eventid="%s">%s</h3>', id, location)
|
||||||
+ sprintf('<p>Ereignis: %s</br>', id)
|
+ sprintf('<p>Ereignis: %s</br>', id)
|
||||||
+ sprintf('Type: %s</br>', type)
|
+ sprintf('Type: %s</br>', type)
|
||||||
|
@ -40,6 +40,7 @@
|
|||||||
<!-- Map, Events & Stations -->
|
<!-- Map, Events & Stations -->
|
||||||
<script type="text/javascript" src="misc.js"></script>
|
<script type="text/javascript" src="misc.js"></script>
|
||||||
<script type="text/javascript" src="geolocation.js"></script>
|
<script type="text/javascript" src="geolocation.js"></script>
|
||||||
|
<script type="text/javascript" src="specialevents.js"></script>
|
||||||
<script type="text/javascript" src="map.js"></script>
|
<script type="text/javascript" src="map.js"></script>
|
||||||
<script type="text/javascript" src="events.js"></script>
|
<script type="text/javascript" src="events.js"></script>
|
||||||
<script type="text/javascript" src="stations.js"></script>
|
<script type="text/javascript" src="stations.js"></script>
|
||||||
|
23
www/map.js
23
www/map.js
@ -41,11 +41,9 @@ function addStationMarker(id, lat, lng, station) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/* add event marker */
|
/* add event marker */
|
||||||
function addEventMarker(id, lat, lng, mag) {
|
function addEventMarker(id, lat, lng, mag, type) {
|
||||||
if ( id == 'bug2014jptq' ) console.log('Adding marker for special event '+id);
|
|
||||||
if ( eventTable[id] ) {
|
if ( eventTable[id] ) {
|
||||||
return eventTable[id];
|
return eventTable[id];
|
||||||
console.log('Marker allready exists ID: '+id);
|
|
||||||
} else {
|
} else {
|
||||||
var markerOptions = {
|
var markerOptions = {
|
||||||
gradient: true,
|
gradient: true,
|
||||||
@ -58,7 +56,19 @@ function addEventMarker(id, lat, lng, mag) {
|
|||||||
className: id+' eventMarker',
|
className: id+' eventMarker',
|
||||||
radius: mag2radius(mag)
|
radius: mag2radius(mag)
|
||||||
};
|
};
|
||||||
var marker = L.circleMarker(L.latLng(lat, lng), markerOptions);
|
var marker;
|
||||||
|
switch ( type ) {
|
||||||
|
case 'earthquake':
|
||||||
|
marker = L.starMarker(L.latLng(lat, lng), markerOptions);
|
||||||
|
break;
|
||||||
|
case 'quarry blast':
|
||||||
|
markerOptions['numberOfPoints'] = 7;
|
||||||
|
markerOptions['innerRadius'] = 0.3*markerOptions['radius'];
|
||||||
|
marker = L.starMarker(L.latLng(lat, lng), markerOptions);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
marker = L.circleMarker(L.latLng(lat, lng), markerOptions);
|
||||||
|
};
|
||||||
eventLayer.addLayer(marker);
|
eventLayer.addLayer(marker);
|
||||||
eventTable[id] = marker;
|
eventTable[id] = marker;
|
||||||
return marker;
|
return marker;
|
||||||
@ -169,8 +179,9 @@ $(document).ready(function() {
|
|||||||
|
|
||||||
// load events
|
// load events
|
||||||
ajaxLoadEvents();
|
ajaxLoadEvents();
|
||||||
//ajaxLoadEvents([], [], ['bug2014jptq', 'gfz2013yvko']);
|
specialEvents.map(function(id) {
|
||||||
ajaxLoadEvents([], [], 'bug2014jptq');
|
ajaxLoadEvents('', '', id)
|
||||||
|
});
|
||||||
toggleFilteredMarkers();
|
toggleFilteredMarkers();
|
||||||
|
|
||||||
// bind popupopen event
|
// bind popupopen event
|
||||||
|
2
www/specialevents.js
Normal file
2
www/specialevents.js
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
/* $Id$ */
|
||||||
|
var specialEvents = ['bug2014jptq', 'gfz2013yvko'];
|
Loading…
Reference in New Issue
Block a user