Adding OpenMapQuest basemap.
This commit is contained in:
parent
b528e286d2
commit
3cfb348cd6
Notes:
subgit
2018-03-07 17:59:08 +01:00
r815 www/tags/20131023
@ -1,9 +1,9 @@
|
||||
/*
|
||||
* JavaScript code to generate maps used by the
|
||||
* Seismological Observatory of the Ruhr-University Bochum
|
||||
*
|
||||
*
|
||||
* Copyright 2013 Kasper D. Fischer <kasper.fischer@rub.de>
|
||||
*
|
||||
*
|
||||
* License
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
@ -28,7 +28,7 @@ var map, mapargs;
|
||||
|
||||
/* Main function to create the map */
|
||||
function init(showGoogle, showStations, showQuakes, noFrils) {
|
||||
|
||||
|
||||
/* get parameters from url */
|
||||
mapargs = OpenLayers.Util.getParameters();
|
||||
if (mapargs['print']) {
|
||||
@ -52,7 +52,7 @@ function init(showGoogle, showStations, showQuakes, noFrils) {
|
||||
showStations = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Creating map */
|
||||
if ( !noFrils ) {
|
||||
map = new OpenLayers.Map(
|
||||
@ -136,8 +136,24 @@ function init(showGoogle, showStations, showQuakes, noFrils) {
|
||||
]);
|
||||
};
|
||||
|
||||
// OpenMapQuest
|
||||
var omq_map_layer = new OpenLayers.Layer.OSM(
|
||||
'OpenMapQuest',
|
||||
[
|
||||
"http://otile1.mqcdn.com/tiles/1.0.0/map/${z}/${x}/${y}.jpg",
|
||||
"http://otile2.mqcdn.com/tiles/1.0.0/map/${z}/${x}/${y}.jpg",
|
||||
"http://otile3.mqcdn.com/tiles/1.0.0/map/${z}/${x}/${y}.jpg",
|
||||
"http://otile4.mqcdn.com/tiles/1.0.0/map/${z}/${x}/${y}.jpg"
|
||||
],
|
||||
{
|
||||
attribution: 'Kartenbasis: Daten von <a href="http://www.openstreetmap.org/">OpenStreetMap</a> - Veröffentlicht unter <a href="http://opendatacommons.org/licenses/odbl/">ODbL</a><br />' +
|
||||
'Seismische Daten von <a href="http://www.gmg.ruhr-uni-bochum.de/geophysik/seisobs">Ruhr-Universität Bochum</a> - Veröffentlicht unter <a href="http://creativecommons.org/licenses/by-sa/3.0/">CC-BY-SA</a>'
|
||||
}
|
||||
);
|
||||
map.addLayers([omq_map_layer]);
|
||||
|
||||
// ESRI
|
||||
var esri_map_layer = new OpenLayers.Layer.XYZ(
|
||||
/* var esri_map_layer = new OpenLayers.Layer.XYZ(
|
||||
'ESRI',
|
||||
"https://server.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer/tile/${z}/${y}/${x}",
|
||||
{
|
||||
@ -146,15 +162,15 @@ function init(showGoogle, showStations, showQuakes, noFrils) {
|
||||
'This work is licensed under the Web Services and API <a href="http://links.esri.com/agol_tou" target="_blank">Terms of Use</a>.'
|
||||
}
|
||||
);
|
||||
map.addLayers([esri_map_layer]);
|
||||
|
||||
map.addLayers([esri_map_layer]); */
|
||||
|
||||
// Show quakes
|
||||
quakes_layer = loadKML(OpenLayers.i18n("Events"), 'quakes.kml', false, true);
|
||||
quakes_layer.events.on({'loadend': setQuakesMapkeyVisibility});
|
||||
quakes_layer.events.on({'visibilitychanged': setQuakesMapkeyVisibility});
|
||||
map.addLayer(quakes_layer);
|
||||
quakes_layer.setVisibility(showQuakes);
|
||||
|
||||
|
||||
// color coding of events
|
||||
var day2sec = 86400.;
|
||||
var timeNow = new Date().getTime()/1000.;
|
||||
@ -163,7 +179,7 @@ function init(showGoogle, showStations, showQuakes, noFrils) {
|
||||
switch ( mapargs['timeCoding'] ){
|
||||
case 'decade':
|
||||
timeCoding = {
|
||||
'colors': [ '#0000ff', '#ff0000', '#ffa500', '#ffff00'],
|
||||
'colors': [ '#0000ff', '#ff0000', '#ffa500', '#ffff00'],
|
||||
'times': [1262300400, 946681200, 631148400, 315529200]
|
||||
// 1.1.2010, 1.1.2000, 1.1.1990, 1.1.1980
|
||||
};
|
||||
@ -171,11 +187,11 @@ function init(showGoogle, showStations, showQuakes, noFrils) {
|
||||
};
|
||||
if (!mapargs['timeCoding'] || !timeCoding ) {
|
||||
timeCoding = {
|
||||
'colors': ['#0000ff', '#ff0000', '#ffa500', '#ffff00'],
|
||||
'colors': ['#0000ff', '#ff0000', '#ffa500', '#ffff00'],
|
||||
'ages': [7*day2sec, 30.4375*day2sec, 182.625*day2sec, 365.25*day2sec]
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
// Adding custom style to quakes
|
||||
var quake_style_default = new OpenLayers.Style({
|
||||
fillColor: '${pntcolor}', fillOpacity: 0.2,
|
||||
@ -185,7 +201,11 @@ function init(showGoogle, showStations, showQuakes, noFrils) {
|
||||
{
|
||||
context: {
|
||||
pntcolor: function(feature){
|
||||
return feature.data.pntcolor.value;
|
||||
try {
|
||||
return feature.data.pntcolor.value;
|
||||
} catch (e) {
|
||||
return "#E020F0"
|
||||
}
|
||||
},
|
||||
/* if (timeCoding['ages']) {
|
||||
quakeAge = feature.data.age.value;
|
||||
@ -209,13 +229,17 @@ function init(showGoogle, showStations, showQuakes, noFrils) {
|
||||
//return '#ffffff00';
|
||||
}, */
|
||||
pntsize: function(feature){
|
||||
// quakeAge = feature.data.age.value;
|
||||
// quakeAge = timeNow - feature.data.time.value;
|
||||
// if ( timeCoding['ages'] && quakeAge > timeCoding['ages'][timeCoding['ages'].length-1] ) {
|
||||
// return 0;
|
||||
// } else {
|
||||
try {
|
||||
// quakeAge = feature.data.age.value;
|
||||
// quakeAge = timeNow - feature.data.time.value;
|
||||
// if ( timeCoding['ages'] && quakeAge > timeCoding['ages'][timeCoding['ages'].length-1] ) {
|
||||
// return 0;
|
||||
// } else {
|
||||
return feature.data.pntsize.value;
|
||||
//}
|
||||
//}
|
||||
} catch (e) {
|
||||
return 6;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -362,7 +386,7 @@ function loadKML(name, file, useStyle, noFrils) {
|
||||
"featureselected": onFeatureSelect,
|
||||
"featureunselected": onFeatureUnselect
|
||||
});
|
||||
|
||||
|
||||
// return layer object
|
||||
return kml_layer;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user