2019-07-26 15:21:08 +02:00
// -*- mode: javascript; indent-tabs-mode: nil; c-basic-offset: 8 -*-
"use strict" ;
// Base layers configuration
2019-07-29 13:45:54 +02:00
// "url" : "https://{a-c}.tile.openstreetmap.org/{z}/{x}/{y}.png"
// "url" : "http://{a-c}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}.png"
// "url" : "http://{a-c}.basemaps.cartocdn.com/dark_all/{z}/{x}/{y}.png"
// "url" : "https://korona.geog.uni-heidelberg.de/tiles/roads/x={x}&y={y}&z={z}"
// "url" : "https://korona.geog.uni-heidelberg.de/tiles/asterh/x={x}&y={y}&z={z}"
// "url" : "https://{a-c}.tile.openstreetmap.de/tiles/osmde/{z}/{x}/{y}.png"
// "url" : "http://{a-c}.tilessputnik.ru/tiles/kmt2/{z}/{x}/{y}.png"
// "url" : "https://{a-c}.tile.openstreetmap.se/hydda/full/{z}/{x}/{y}.png"
// "url" : "https://{a-c}.tile.openstreetmap.se/osm/{z}/{x}/{y}.png"
2019-07-26 15:21:08 +02:00
function createBaseLayers ( ) {
var layers = [ ] ;
var world = [ ] ;
var us = [ ] ;
2019-07-29 13:45:54 +02:00
// opacity: 0.9,
2019-07-26 15:21:08 +02:00
world . push ( new ol . layer . Tile ( {
source : new ol . source . OSM ( {
"url" : "https://maps.wikimedia.org/osm-intl/{z}/{x}/{y}.png"
} ) ,
2019-07-29 13:45:54 +02:00
name : 'wikimedia' ,
title : 'OpenStreetMap Wikimedia' ,
type : 'base' ,
} ) ) ;
world . push ( new ol . layer . Tile ( {
source : new ol . source . OSM ( ) ,
2019-07-26 15:21:08 +02:00
name : 'osm' ,
title : 'OpenStreetMap' ,
type : 'base' ,
} ) ) ;
2019-07-29 13:45:54 +02:00
world . push ( new ol . layer . Tile ( {
source : new ol . source . OSM ( {
"url" : "http://{a-d}.tile.stamen.com/terrain/{z}/{x}/{y}.png" ,
"attributions" : 'Map tiles by <a href="http://stamen.com">Stamen Design</a>, under <a href="http://creativecommons.org/licenses/by/3.0">CC BY 3.0</a>. '
+ 'Data by <a _href="http://openstreetmap.org">OpenStreetMap</a>, under <a href="http://www.openstreetmap.org/copyright">ODbL</a>.' ,
} ) ,
2019-08-07 17:35:41 +02:00
name : 'terrain_roads' ,
2019-07-29 13:45:54 +02:00
title : 'Terrain + Roads' ,
type : 'base' ,
} ) ) ;
world . push ( new ol . layer . Tile ( {
source : new ol . source . OSM ( {
"url" : "http://{a-d}.tile.stamen.com/terrain-background/{z}/{x}/{y}.png" ,
"attributions" : 'Map tiles by <a href="http://stamen.com">Stamen Design</a>, under <a href="http://creativecommons.org/licenses/by/3.0">CC BY 3.0</a>. '
+ 'Data by <a href="http://openstreetmap.org">OpenStreetMap</a>, under <a href="http://www.openstreetmap.org/copyright">ODbL</a>.' ,
} ) ,
name : 'terrain' ,
title : 'Terrain' ,
type : 'base' ,
} ) ) ;
2019-09-22 00:36:45 +02:00
world . push ( new ol . layer . Tile ( {
source : new ol . source . OSM ( {
url : 'https://gibs-{a-c}.earthdata.nasa.gov/wmts/epsg3857/best/' +
'MODIS_Terra_CorrectedReflectance_TrueColor/default/2019-07-22/' +
'GoogleMapsCompatible_Level9/{z}/{y}/{x}.jpg' ,
} ) ,
name : 'GIBS' ,
title : 'GIBS' ,
type : 'base' ,
} ) ) ;
2019-07-29 13:45:54 +02:00
// carto.com basemaps, see the following URLs for details on them:
// http://basemaps.cartocdn.com
// https://github.com/CartoDB/cartodb/wiki/BaseMaps-available
2019-09-22 00:36:45 +02:00
var basemaps = [ "dark_all" , "dark_nolabels" ,
"light_all" , "light_nolabels"
2019-07-29 13:45:54 +02:00
]
for ( var i in basemaps ) {
var basemap _id = basemaps [ i ] ;
2019-07-29 13:55:16 +02:00
2019-07-29 13:45:54 +02:00
world . push ( new ol . layer . Tile ( {
source : new ol . source . OSM ( {
"url" : "http://{a-z}.basemaps.cartocdn.com/" + basemap _id + "/{z}/{x}/{y}.png" ,
"attributions" : 'Courtesy of <a href="https://carto.com">CARTO.com</a>'
2019-07-29 13:55:16 +02:00
+ ' using data by <a href="http://openstreetmap.org">OpenStreetMap</a>, under <a href="http://www.openstreetmap.org/copyright">ODbL</a>.' ,
2019-07-29 13:45:54 +02:00
} ) ,
name : "carto_" + basemap _id ,
title : 'carto.com ' + basemap _id ,
type : 'base' ,
} ) ) ;
}
2019-07-26 15:21:08 +02:00
if ( BingMapsAPIKey ) {
world . push ( new ol . layer . Tile ( {
source : new ol . source . BingMaps ( {
key : BingMapsAPIKey ,
imagerySet : 'Aerial'
} ) ,
name : 'bing_aerial' ,
title : 'Bing Aerial' ,
type : 'base' ,
} ) ) ;
world . push ( new ol . layer . Tile ( {
source : new ol . source . BingMaps ( {
key : BingMapsAPIKey ,
imagerySet : 'Road'
} ) ,
name : 'bing_roads' ,
title : 'Bing Roads' ,
type : 'base' ,
} ) ) ;
}
2019-08-01 18:40:27 +02:00
if ( ChartBundleLayers ) {
var chartbundleTypes = {
sec : "Sectional Charts" ,
tac : "Terminal Area Charts" ,
hel : "Helicopter Charts" ,
enrl : "IFR Enroute Low Charts" ,
enra : "IFR Area Charts" ,
enrh : "IFR Enroute High Charts"
} ;
for ( var type in chartbundleTypes ) {
us . push ( new ol . layer . Tile ( {
source : new ol . source . TileWMS ( {
url : 'http://wms.chartbundle.com/wms' ,
params : { LAYERS : type } ,
projection : 'EPSG:3857' ,
attributions : 'Tiles courtesy of <a href="http://www.chartbundle.com/">ChartBundle</a>'
} ) ,
name : 'chartbundle_' + type ,
title : chartbundleTypes [ type ] ,
type : 'base' ,
group : 'chartbundle' } ) ) ;
}
2019-07-26 15:21:08 +02:00
}
var nexrad = new ol . layer . Tile ( {
name : 'nexrad' ,
title : 'NEXRAD' ,
type : 'overlay' ,
opacity : 0.5 ,
visible : false
} ) ;
us . push ( nexrad ) ;
var refreshNexrad = function ( ) {
// re-build the source to force a refresh of the nexrad tiles
var now = new Date ( ) . getTime ( ) ;
nexrad . setSource ( new ol . source . XYZ ( {
url : 'http://mesonet{1-3}.agron.iastate.edu/cache/tile.py/1.0.0/nexrad-n0q-900913/{z}/{x}/{y}.png?_=' + now ,
attributions : 'NEXRAD courtesy of <a href="http://mesonet.agron.iastate.edu/">IEM</a>'
} ) ) ;
} ;
refreshNexrad ( ) ;
window . setInterval ( refreshNexrad , 5 * 60000 ) ;
if ( world . length > 0 ) {
layers . push ( new ol . layer . Group ( {
name : 'world' ,
title : 'Worldwide' ,
layers : world
} ) ) ;
}
if ( us . length > 0 ) {
layers . push ( new ol . layer . Group ( {
name : 'us' ,
title : 'US' ,
layers : us
} ) ) ;
}
return layers ;
}