Merging changes from life branch.

This commit is contained in:
2015-10-01 15:44:23 +00:00
Notes: subgit 2018-03-07 17:59:12 +01:00
r839 www/trunk
9 changed files with 65 additions and 26 deletions

View File

@@ -41,15 +41,18 @@ function addTableRow(row, table) {
/* do reverse geolocation lookup */
function getGeolocation(id, lat, lng) {
if ( !geolocationTable[id] ) {
$.getJSON( config['ajax']['nominatimURL'], { lat: lat, lon: lng, zoom: 10, format: "json" } )
$.getJSON( config['ajax']['nominatimURL'], { lat: lat, lon: lng } )
.done(function( json ) {
var city = json.address["city"];
if ( ~city ) { city = json.address["town"]; };
if ( ~city ) { city = json.address["village"]; };
var country = json.address["country"];
var countryCode = json.address["country_code"].toUpperCase();
var city = json.features[0].properties.city;
var countryCode = json.features[0].properties.country;
geolocationTable[id] = city;
( countryCode != "DE" ) ? geolocationTable[id] = geolocationTable[id] + " ("+countryCode+")" : null;
( countryCode != "Germany" ) ? geolocationTable[id] = geolocationTable[id] + " ("+countryCode+")" : null;
if ( city ) {
$("#eventstable a.toggle[eventid="+id+"]").text(geolocationTable[id]);
var sort = [[0,1],[1,1],[2,1]];
@@ -120,12 +123,10 @@ function ajaxLoadEvents(stime, etime, eventid, url, target) {
var evaluationStatus = $(this).find('origin > evaluationStatus').text();
var type = $(this).find('type').last().text();
var location
// get location, try this in order:
// regional map name, given value, cached value, or nominatim lookup
geolocationTable[id] ? null : getGeolocation(id, lat, lng); // do AJAX lookup if not cached, location will be updated later
location = ( geolocationTable[id] || getLocation(lat, lng)[0] || $(this).find('description > text').text() );
// 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'] ) {
geolocationTable[id] ? null : getGeolocation(id, lat, lng); // do AJAX lookup if not cached, location will be updated later
location = ( geolocationTable[id] || getLocation(lat, lng)[0] || $(this).find('description > text').text() );
// general event info (1st line)
var row = '<tr class="tablesorter-hasChildRow">'
+ '<td class="utctime-date">'+otime.split('.')[0]+'Z</td>'

View File

@@ -41,15 +41,18 @@ function addTableRow(row, table) {
/* do reverse geolocation lookup */
function getGeolocation(id, lat, lng) {
if ( !geolocationTable[id] ) {
$.getJSON( config['ajax']['nominatimURL'], { lat: lat, lon: lng, zoom: 10, format: "json" } )
$.getJSON( config['ajax']['nominatimURL'], { lat: lat, lon: lng } )
.done(function( json ) {
var city = json.address["city"];
if ( ~city ) { city = json.address["town"]; };
if ( ~city ) { city = json.address["village"]; };
var country = json.address["country"];
var countryCode = json.address["country_code"].toUpperCase();
var city = json.features[0].properties.city;
var countryCode = json.features[0].properties.country;
geolocationTable[id] = city;
( countryCode != "DE" ) ? geolocationTable[id] = geolocationTable[id] + " ("+countryCode+")" : null;
( countryCode != "Germany" ) ? geolocationTable[id] = geolocationTable[id] + " ("+countryCode+")" : null;
if ( city ) {
$("#eventstable a.toggle[eventid="+id+"]").text(geolocationTable[id]);
var sort = [[0,1],[1,1],[2,1]];
@@ -121,11 +124,9 @@ function ajaxLoadEvents(stime, etime, eventid, url, target) {
var type = $(this).find('type').last().text();
var location
// get location, try this in order:
// regional map name, given value, cached value, or nominatim lookup
geolocationTable[id] ? null : getGeolocation(id, lat, lng); // do AJAX lookup if not cached, location will be updated later
location = ( geolocationTable[id] || getLocation(lat, lng)[0] || $(this).find('description > text').text() );
// 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'] ) {
geolocationTable[id] ? null : getGeolocation(id, lat, lng); // do AJAX lookup if not cached, location will be updated later
location = ( geolocationTable[id] || getLocation(lat, lng)[0] || $(this).find('description > text').text() );
// general event info (1st line)
var row = '<tr class="tablesorter-hasChildRow">'
+ '<td class="utctime-date">'+otime.split('.')[0]+'Z</td>'

View File

@@ -115,7 +115,7 @@
<span id="events-type">Symbole:</span>
</p>
<p class="table-caption">
Nominatim Search Courtesy of <a href="http://www.mapquest.com/" target="_blank">MapQuest</a> <img alt="Mapquest Logo" src="//developer.mapquest.com/content/osm/mq_logo.png" />
Reverse Geolocation courtesy of <a href="http://photon.komoot.de/" target="_blank">Photon by Komoot</a>
</p>
</div>
<!-- Stations -->
@@ -176,7 +176,7 @@
</div>
<!-- Logo -->
<div class="rublogo"><a href="http://www.gmg.ruhr-uni-bochum.de/geophysik/seisobs"><img class="rublogo" src="logo_RUB_155x30.png" alt="Ruhr-Universität Bochum" title="Ruhr-Universität Bochum" border="0"/></a></div>
<!-- Map -->
<!-- Map -->
<div id="map" class="map"></div>
<div id="spinner" class="spinner" style="display:none;"><img id="img-spinner" src="spinner.gif" alt="Loading"/><br />Loading ...</div>
</body>

View File

@@ -15,7 +15,7 @@
<link rel="stylesheet" href="external/leaflet.css" />
<!-- link rel="stylesheet" href="external/css/dvf.css" type="text/css" media="screen" / -->
<link rel="stylesheet" href="external/css/leaflet.label.css" type="text/css" media="screen" />
<!-- <link rel="stylesheet" href="external/easyPrint.css"/> -->
<link rel="stylesheet" href="external/easyPrint.css"/>
<!-- jQuery & jQueryUI -->
<script type="text/javascript" src="//code.jquery.com/jquery-1.11.0.min.js"></script>
@@ -37,8 +37,8 @@
<script type="text/javascript" src="external/TileLayer.Grayscale.js"></script>
<script type="text/javascript" src="external/leaflet-dvf.markers.min.js"></script>
<script type="text/javascript" src="external/leaflet.label.js"></script>
<!-- <script src="external/jQuery.print.js"></script> -->
<!-- <script src="external/leaflet.easyPrint.js"></script> -->
<script src="external/jQuery.print.js"></script>
<script src="external/leaflet.easyPrint.js"></script>
<!-- Map, Events & Stations -->
<script type="text/javascript" src="misc.js"></script>
@@ -96,7 +96,6 @@
<col width="50" />
<col width="50" />
<col />
<col width="30" />
</colgroup>
<thead>
<tr>

View File

@@ -24,7 +24,7 @@
/* add station marker */
function addStationMarker(id, lat, lng, station) {
var marker = L.triangleMarker(L.latLng(lat, lng),
var marker = L.triangleMarker(L.latLng(lat, lng),
{
gradient: true,
fillColor: config['station']['markerColor'],
@@ -38,7 +38,7 @@ function addStationMarker(id, lat, lng, station) {
marker.bindLabel('Station '+station);
stationLayer.addLayer(marker);
stationTable[id] = marker;
};
};
/* add event marker */
function addEventMarker(id, lat, lng, mag, type) {
@@ -79,7 +79,7 @@ function addEventMarker(id, lat, lng, mag, type) {
eventTable[id] = marker;
return marker;
};
};
};
/* handle to show events on map */
function initMapLink() {
@@ -158,6 +158,12 @@ $(document).ready(function() {
attribution: 'Tiles &copy; Esri &mdash; Source: Esri, i-cubed, USDA, USGS, AEX, GeoEye, Getmapping, Aerogrid, IGN, IGP, UPR-EGP, and the GIS User Community'
}).addTo(map);
break;
case 'komoot': // add OpenStreetMap.DE tile layer
L.tileLayer('//www.komoot.de/tiles/{s}/{z}/{x}/{y}.png',
{
attribution: 'Map data &copy; <a href="https://openstreetmap.org">OpenStreetMap</a> contributors, <a href="https://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a> | Tiles Courtesy of <a href="http://www.komoot.de/">Komoot</a>',
}).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',
{

View File

@@ -158,6 +158,12 @@ $(document).ready(function() {
attribution: 'Tiles &copy; Esri &mdash; Source: Esri, i-cubed, USDA, USGS, AEX, GeoEye, Getmapping, Aerogrid, IGN, IGP, UPR-EGP, and the GIS User Community'
}).addTo(map);
break;
case 'komoot': // add OpenStreetMap.DE tile layer
L.tileLayer('//www.komoot.de/tiles/{s}/{z}/{x}/{y}.png',
{
attribution: 'Map data &copy; <a href="https://openstreetmap.org">OpenStreetMap</a> contributors, <a href="https://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a> | Tiles Courtesy of <a href="http://www.komoot.de/">Komoot</a>',
}).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',
{
@@ -216,6 +222,5 @@ $(document).ready(function() {
});
// print icon
// L.easyPrint().addTo(map);
L.easyPrint().addTo(map);
});

View File

@@ -95,9 +95,8 @@ var config = {
dlsvURL: 'dlsv',
mseedURL: '/fdsnws/dataselect/1/query',
stationURL: '/fdsnws/station/1/query',
nominatimURL: '//open.mapquestapi.com/nominatim/v1/reverse.php',
// nominatimURL: '//nominatim.openstreetmap.org/reverse',
timespan: 60,
nominatimURL: 'https://photon.komoot.de/reverse',
timespan: 180,
},
event: {
evaluationBlacklist: ['automatic', 'preliminary', 'rejected'],