2020-01-03 21:16:40 +01:00
// -*- mode: javascript; indent-tabs-mode: nil; c-basic-offset: 8 -*-
"use strict" ;
// Base layers configuration
// "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"
function createBaseLayers ( ) {
2020-03-27 08:45:56 +01:00
let layers = new ol . Collection ( ) ;
let layers _group = new ol . layer . Group ( {
2020-01-03 21:16:40 +01:00
layers : layers ,
} ) ;
2020-03-27 08:45:56 +01:00
let world = new ol . Collection ( ) ;
let us = new ol . Collection ( ) ;
let europe = new ol . Collection ( ) ;
2020-01-03 21:16:40 +01:00
2022-07-31 16:16:24 +02:00
const tileTransition = onMobile ? 0 : 150 ;
2021-09-05 20:50:34 +02:00
if ( loStore [ 'customTiles' ] != undefined ) {
2022-05-28 19:35:27 +02:00
custom _layers . push ( new ol . layer . Tile ( {
2020-02-08 20:32:04 +01:00
source : new ol . source . OSM ( {
2021-09-05 20:50:34 +02:00
"url" : loStore [ 'customTiles' ] ,
2021-04-28 16:11:24 +02:00
maxZoom : 15 ,
2022-07-31 16:16:24 +02:00
transition : tileTransition ,
2020-02-08 20:32:04 +01:00
} ) ,
name : 'custom_tiles' ,
title : 'Custom tiles' ,
type : 'base' ,
} ) ) ;
}
2020-02-08 19:38:42 +01:00
/ *
2020-01-03 21:16:40 +01:00
world . push ( new ol . layer . Tile ( {
source : new ol . source . OSM ( {
"url" : "https://maps.wikimedia.org/osm-intl/{z}/{x}/{y}.png"
} ) ,
name : 'wikimedia' ,
title : 'OpenStreetMap Wikimedia' ,
type : 'base' ,
} ) ) ;
2020-02-08 19:38:42 +01:00
* /
2020-01-03 21:16:40 +01:00
2022-04-16 06:39:18 +02:00
if ( offlineMapDetail > 0 ) {
world . push ( new ol . layer . Tile ( {
source : new ol . source . OSM ( {
"url" : "osm_tiles_offline/{z}/{x}/{y}.png" ,
attributionsCollapsible : false ,
maxZoom : offlineMapDetail ,
2022-07-31 16:16:24 +02:00
transition : tileTransition ,
2022-04-16 06:39:18 +02:00
} ) ,
name : 'osm_tiles_offline' ,
title : 'OpenStreetMap offline' ,
type : 'base' ,
} ) ) ;
}
2020-01-03 21:16:40 +01:00
2023-05-02 10:48:05 +02:00
if ( adsbexchange ) {
world . push ( new ol . layer . Tile ( {
source : new ol . source . OSM ( {
"url" : "https://map.adsbexchange.com/mapproxy/tiles/1.0.0/osm/osm_grid/{z}/{x}/{y}.png" ,
attributionsCollapsible : false ,
maxZoom : 16 ,
transition : tileTransition ,
} ) ,
name : 'osm_adsbx' ,
title : 'OpenStreetMap ADSBx' ,
type : 'base' ,
} ) ) ;
} else {
world . push ( new ol . layer . Tile ( {
source : new ol . source . OSM ( {
maxZoom : 17 ,
attributionsCollapsible : false ,
transition : tileTransition ,
} ) ,
name : 'osm' ,
title : 'OpenStreetMap' ,
type : 'base' ,
} ) ) ;
}
2020-01-03 21:16:40 +01:00
2022-04-29 02:23:50 +02:00
let basemap _id = "rastertiles/voyager" ;
world . push ( new ol . layer . Tile ( {
source : new ol . source . OSM ( {
"url" : "https://{a-d}.basemaps.cartocdn.com/" + basemap _id + "/{z}/{x}/{y}.png" ,
"attributions" : 'Powered by <a href="https://carto.com">CARTO.com</a>'
+ ' using data by <a href="http://openstreetmap.org">OpenStreetMap</a>, under <a href="http://www.openstreetmap.org/copyright">ODbL</a>.' ,
attributionsCollapsible : false ,
maxZoom : 15 ,
2022-07-31 16:16:24 +02:00
transition : tileTransition ,
2022-04-29 02:23:50 +02:00
} ) ,
name : "carto_" + basemap _id ,
title : 'CARTO.com English' ,
type : 'base' ,
} ) ) ;
2022-03-15 13:44:06 +01:00
if ( ! adsbexchange ) {
world . push ( new ol . layer . Tile ( {
source : new ol . source . OSM ( {
"url" : "https://{a-d}.tile.openstreetmap.de/{z}/{x}/{y}.png" ,
attributionsCollapsible : false ,
maxZoom : 17 ,
2022-07-31 16:16:24 +02:00
transition : tileTransition ,
2022-03-15 13:44:06 +01:00
} ) ,
2022-03-19 15:30:59 +01:00
name : 'osm_de' ,
2022-03-15 13:44:06 +01:00
title : 'OpenStreetMap DE' ,
type : 'base' ,
} ) ) ;
}
2022-06-07 19:45:22 +02:00
if ( false && adsbexchange ) {
2022-06-15 18:47:23 +02:00
jQuery ( '#premium_text' ) . updateText ( 'Premium active!' ) ;
2022-04-29 00:21:24 +02:00
world . push ( new ol . layer . Tile ( {
source : new ol . source . XYZ ( {
2022-06-07 19:45:22 +02:00
url : "https://api.maptiler.com/tiles/satellite-v2/{z}/{x}/{y}.jpg?key=HyIQ6A88uTDdX4n4MNVY" ,
2022-04-29 00:21:24 +02:00
attributions : '<a href="https://www.maptiler.com/copyright/" target="_blank">© MapTiler</a> <a href="https://www.openstreetmap.org/copyright" target="_blank">© OpenStreetMap contributors</a>' ,
attributionsCollapsible : false ,
2022-06-07 19:45:22 +02:00
maxZoom : 19 ,
2022-07-31 16:16:24 +02:00
transition : tileTransition ,
2022-04-29 00:21:24 +02:00
} ) ,
2022-06-07 19:45:22 +02:00
name : 'maptiler_sat' ,
title : 'Satellite (Premium)' ,
2022-04-29 00:21:24 +02:00
type : 'base' ,
} ) ) ;
2022-04-27 19:52:04 +02:00
world . push ( new ol . layer . Tile ( {
source : new ol . source . XYZ ( {
2022-06-07 19:45:22 +02:00
url : "https://api.maptiler.com/maps/hybrid/256/{z}/{x}/{y}.jpg?key=HyIQ6A88uTDdX4n4MNVY" ,
2022-04-27 19:52:04 +02:00
attributions : '<a href="https://www.maptiler.com/copyright/" target="_blank">© MapTiler</a> <a href="https://www.openstreetmap.org/copyright" target="_blank">© OpenStreetMap contributors</a>' ,
attributionsCollapsible : false ,
2022-06-07 19:45:22 +02:00
maxZoom : 19 ,
2022-07-31 16:16:24 +02:00
transition : tileTransition ,
2022-04-27 19:52:04 +02:00
} ) ,
2022-06-07 19:45:22 +02:00
name : 'maptiler_hybrid' ,
title : 'Hybrid Sat. (Premium)' ,
2022-04-27 19:52:04 +02:00
type : 'base' ,
} ) ) ;
2022-04-27 20:03:22 +02:00
world . push ( new ol . layer . Tile ( {
source : new ol . source . XYZ ( {
2022-06-07 19:45:22 +02:00
url : "https://api.maptiler.com/maps/777ad15e-3e64-4edf-8e86-84ba16e50961/256/{z}/{x}/{y}.png?key=geutV4UHZB7QFdlzE3w4" ,
attributions : '<a href="https://www.maptiler.com/copyright/" target="_blank">© MapTiler</a> <a href="https://www.openstreetmap.org/copyright" target="_blank">© OpenStreetMap contributors</a>' ,
attributionsCollapsible : false ,
maxZoom : 19 ,
2022-07-31 16:16:24 +02:00
transition : tileTransition ,
2022-06-07 19:45:22 +02:00
} ) ,
name : 'maptiler_custom' ,
title : 'ADSBx Custom (Premium)' ,
type : 'base' ,
} ) ) ;
}
if ( 0 && adsbexchange ) {
world . push ( new ol . layer . Tile ( {
source : new ol . source . XYZ ( {
url : "https://api.maptiler.com/maps/256/{z}/{x}/{y}.png?key=HyIQ6A88uTDdX4n4MNVY" ,
2022-04-27 20:03:22 +02:00
attributions : '<a href="https://www.maptiler.com/copyright/" target="_blank">© MapTiler</a> <a href="https://www.openstreetmap.org/copyright" target="_blank">© OpenStreetMap contributors</a>' ,
attributionsCollapsible : false ,
2022-05-07 08:22:14 +02:00
maxZoom : 16 ,
2022-07-31 16:16:24 +02:00
transition : tileTransition ,
2022-04-27 20:03:22 +02:00
} ) ,
2022-06-07 19:45:22 +02:00
name : 'maptiler_english' ,
title : 'English MapTiler (testing)' ,
2022-04-27 20:03:22 +02:00
type : 'base' ,
} ) ) ;
2022-04-27 19:52:04 +02:00
}
2022-04-21 20:48:08 +02:00
if ( ! adsbexchange ) {
world . push ( new ol . layer . Tile ( {
source : new ol . source . XYZ ( {
url : "https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}" ,
attributions : 'Powered by <a href="https://www.esri.com">Esri.com</a>' +
'— Sources: Esri, i-cubed, USDA, USGS, AEX, GeoEye, Getmapping, Aerogrid, IGN, IGP, UPR-EGP, and the GIS User Community' ,
attributionsCollapsible : false ,
maxZoom : 17 ,
2022-07-31 16:16:24 +02:00
transition : tileTransition ,
2022-04-21 20:48:08 +02:00
} ) ,
name : 'esri' ,
title : 'ESRI.com Sat.' ,
type : 'base' ,
} ) ) ;
world . push ( new ol . layer . Tile ( {
source : new ol . source . XYZ ( {
url : "https://services.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Base/MapServer/tile/{z}/{y}/{x}" ,
attributions : 'Powered by <a href="https://www.esri.com">Esri.com</a>' +
'— Sources: Esri, i-cubed, USDA, USGS, AEX, GeoEye, Getmapping, Aerogrid, IGN, IGP, UPR-EGP, and the GIS User Community' ,
attributionsCollapsible : false ,
maxZoom : 16 ,
2022-07-31 16:16:24 +02:00
transition : tileTransition ,
2022-04-21 20:48:08 +02:00
} ) ,
name : 'esri_gray' ,
title : 'ESRI.com Gray' ,
type : 'base' ,
} ) ) ;
world . push ( new ol . layer . Tile ( {
source : new ol . source . XYZ ( {
url : "https://services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer/tile/{z}/{y}/{x}" ,
attributions : 'Powered by <a href="https://www.esri.com">Esri.com</a>' +
'— Sources: Esri, i-cubed, USDA, USGS, AEX, GeoEye, Getmapping, Aerogrid, IGN, IGP, UPR-EGP, and the GIS User Community' ,
attributionsCollapsible : false ,
maxZoom : 17 ,
2022-07-31 16:16:24 +02:00
transition : tileTransition ,
2022-04-21 20:48:08 +02:00
} ) ,
name : 'esri_streets' ,
title : 'ESRI.com Streets' ,
type : 'base' ,
} ) ) ;
}
2021-04-27 20:49:50 +02:00
2022-06-12 07:20:33 +02:00
// testing ...
if ( 0 ) {
let english _map = new ol . layer . VectorTile ( {
declutter : true ,
type : 'base' ,
name : 'english_map' ,
title : 'English Map' ,
} ) ;
// ol-mapbox-style plugin packed in with ol ... (kinda ugly)
//ol.applyStyle(english_map, "https://tiles.adsb.co/api/maps/basic/style.json");
world . push ( english _map ) ;
}
2021-04-27 20:49:50 +02:00
if ( 0 ) {
let vtlayer = new ol . layer . VectorTile ( {
source : new ol . source . VectorTile ( {
2021-04-28 16:11:24 +02:00
url : "http://test02.dev.adsbexchange.com/tiles/{z}/{x}/{y}.pbf" ,
2021-04-27 20:49:50 +02:00
format : new ol . format . MVT ( ) ,
2021-05-02 17:17:10 +02:00
maxZoom : 9 ,
2022-07-31 16:16:24 +02:00
transition : tileTransition ,
2021-04-27 20:49:50 +02:00
} ) ,
name : 'vtlayer' ,
2021-05-02 17:17:10 +02:00
title : 'TEST VECTOR' ,
2021-04-27 20:49:50 +02:00
type : 'base' ,
renderMode : 'image' ,
} ) ;
2021-05-28 07:32:37 +02:00
jQuery . ajax ( {
2021-05-02 17:17:10 +02:00
url : 'osm-liberty/style.json' ,
dataType : 'json' ,
layer : vtlayer ,
cache : false ,
} ) . done ( function ( glStyle ) {
ol . mbApplyStyle ( this . layer , glStyle , 'openmaptiles' ) ;
2021-04-27 20:49:50 +02:00
} ) ;
world . push ( vtlayer ) ;
}
2020-01-03 21:16:40 +01:00
2022-04-25 19:22:48 +02:00
world . push ( new ol . layer . Tile ( {
source : new ol . source . OSM ( {
url : 'https://gibs-{a-c}.earthdata.nasa.gov/wmts/epsg3857/best/BlueMarble_ShadedRelief_Bathymetry/default/EPSG3857_500m/{z}/{y}/{x}.jpeg' ,
attributions : '<a href="https://terra.nasa.gov/about/terra-instruments/modis">MODIS Terra</a> ' +
2023-03-21 16:10:55 +02:00
'Provided by NASA\'s Global Imagery Browse Services (GIBS), part of NASA\'s Earth Observing System Data and Information System (EOSDIS)' ,
2022-04-25 19:22:48 +02:00
maxZoom : 8 ,
2022-07-31 16:16:24 +02:00
transition : tileTransition ,
2022-04-25 19:22:48 +02:00
} ) ,
name : 'gibs_reliev' ,
title : 'GIBS Relief' ,
type : 'base' ,
} ) ) ;
2021-04-28 16:11:24 +02:00
const date = new Date ( Date . now ( ) - 86400 * 1000 ) ;
const yesterday = date . getUTCFullYear ( ) + '-' + ( date . getUTCMonth ( ) + 1 ) . toString ( ) . padStart ( 2 , '0' ) + '-' + date . getUTCDate ( ) . toString ( ) . padStart ( 2 , '0' ) ;
2020-01-03 21:16:40 +01:00
world . push ( new ol . layer . Tile ( {
source : new ol . source . OSM ( {
url : 'https://gibs-{a-c}.earthdata.nasa.gov/wmts/epsg3857/best/' +
2021-04-28 16:11:24 +02:00
'MODIS_Terra_CorrectedReflectance_TrueColor/default/' +
yesterday + '/' +
2020-01-03 21:16:40 +01:00
'GoogleMapsCompatible_Level9/{z}/{y}/{x}.jpg' ,
2021-04-28 16:11:24 +02:00
attributions : '<a href="https://terra.nasa.gov/about/terra-instruments/modis">MODIS Terra</a> ' +
yesterday + ' Provided by NASA\'s Global Imagery Browse Services (GIBS), part of NASA\'s Earth Observing System Data and Information System (EOSDIS)' ,
2021-04-27 20:49:50 +02:00
maxZoom : 9 ,
2022-07-31 16:16:24 +02:00
transition : tileTransition ,
2020-01-03 21:16:40 +01:00
} ) ,
2020-04-15 10:20:38 +02:00
name : 'gibs' ,
2022-04-25 19:22:48 +02:00
title : 'GIBS Clouds ' + yesterday ,
2020-01-03 21:16:40 +01:00
type : 'base' ,
} ) ) ;
// carto.com basemaps, see the following URLs for details on them:
// http://basemaps.cartocdn.com
// https://github.com/CartoDB/cartodb/wiki/BaseMaps-available
2022-04-29 02:23:50 +02:00
let basemaps = [ "dark_all" , "dark_nolabels" ,
2020-01-03 21:16:40 +01:00
"light_all" , "light_nolabels"
]
2021-04-28 16:11:24 +02:00
if ( 1 ) {
2021-04-24 18:13:33 +02:00
for ( let i in basemaps ) {
let basemap _id = basemaps [ i ] ;
2020-01-03 21:16:40 +01:00
2021-04-24 18:13:33 +02:00
world . push ( new ol . layer . Tile ( {
source : new ol . source . OSM ( {
"url" : "https://{a-d}.basemaps.cartocdn.com/" + basemap _id + "/{z}/{x}/{y}.png" ,
2021-04-28 16:11:24 +02:00
"attributions" : 'Powered by <a href="https://carto.com">CARTO.com</a>'
2021-04-24 18:13:33 +02:00
+ ' using data by <a href="http://openstreetmap.org">OpenStreetMap</a>, under <a href="http://www.openstreetmap.org/copyright">ODbL</a>.' ,
2021-04-28 16:11:24 +02:00
attributionsCollapsible : false ,
maxZoom : 15 ,
2022-07-31 16:16:24 +02:00
transition : tileTransition ,
2021-04-24 18:13:33 +02:00
} ) ,
name : "carto_" + basemap _id ,
2022-04-29 01:59:22 +02:00
title : 'CARTO.com ' + basemap _id ,
2021-04-24 18:13:33 +02:00
type : 'base' ,
} ) ) ;
}
2020-01-03 21:16:40 +01:00
}
2021-09-05 20:50:34 +02:00
if ( loStore [ 'bingKey' ] != undefined )
BingMapsAPIKey = loStore [ 'bingKey' ] ;
2020-05-07 21:48:32 +02:00
2020-01-03 21:16:40 +01:00
if ( BingMapsAPIKey ) {
world . push ( new ol . layer . Tile ( {
source : new ol . source . BingMaps ( {
key : BingMapsAPIKey ,
2022-07-31 16:16:24 +02:00
imagerySet : 'Aerial' ,
transition : tileTransition ,
2020-01-03 21:16:40 +01:00
} ) ,
name : 'bing_aerial' ,
title : 'Bing Aerial' ,
type : 'base' ,
} ) ) ;
world . push ( new ol . layer . Tile ( {
source : new ol . source . BingMaps ( {
key : BingMapsAPIKey ,
2022-07-31 16:16:24 +02:00
imagerySet : 'RoadOnDemand' ,
transition : tileTransition ,
2020-01-03 21:16:40 +01:00
} ) ,
name : 'bing_roads' ,
title : 'Bing Roads' ,
type : 'base' ,
} ) ) ;
}
if ( ChartBundleLayers ) {
2023-05-02 10:48:05 +02:00
let chartbundleTypesDirect = {
2020-01-03 21:16:40 +01:00
sec : "Sectional Charts" ,
2022-04-01 17:45:24 +02:00
enrh : "IFR Enroute High Charts" ,
tac : "Terminal Area Charts" ,
hel : "Helicopter Charts" ,
enrl : "IFR Enroute Low Charts" ,
enra : "IFR Area Charts" ,
2023-05-02 10:48:05 +02:00
secgrids : "Sect. w/ SAR grid" ,
} ;
let chartbundleTypesAx = {
2020-06-17 18:42:30 +02:00
} ;
2023-05-02 10:48:05 +02:00
if ( adsbexchange ) {
chartbundleTypesDirect = {
secgrids : "Sect. w/ SAR grid" ,
} ;
chartbundleTypesAx = {
sec : "Sectional Charts" ,
enrh : "IFR Enroute High Charts" ,
2020-06-17 18:42:30 +02:00
2023-05-02 10:48:05 +02:00
tac : "Terminal Area Charts" ,
hel : "Helicopter Charts" ,
enrl : "IFR Enroute Low Charts" ,
enra : "IFR Area Charts" ,
} ;
}
for ( let type in chartbundleTypesAx ) {
2020-06-17 18:42:30 +02:00
us . push ( new ol . layer . Tile ( {
2022-04-01 17:45:24 +02:00
source : new ol . source . OSM ( {
url : 'https://map.adsbexchange.com/mapproxy/tiles/1.0.0/' + type + '/osm_grid/{z}/{x}/{y}.png' ,
2020-06-17 18:42:30 +02:00
projection : 'EPSG:3857' ,
2021-04-27 20:49:50 +02:00
attributions : 'Tiles courtesy of <a href="http://www.chartbundle.com/">ChartBundle</a>' ,
2021-04-28 16:11:24 +02:00
attributionsCollapsible : false ,
2022-04-01 17:45:24 +02:00
maxZoom : 11 ,
2022-07-31 16:16:24 +02:00
transition : tileTransition ,
2020-06-17 18:42:30 +02:00
} ) ,
name : 'chartbundle_' + type ,
2023-05-02 10:48:05 +02:00
title : chartbundleTypesAx [ type ] ,
2020-06-17 18:42:30 +02:00
type : 'base' ,
group : 'chartbundle' } ) ) ;
}
2020-01-03 21:16:40 +01:00
2023-05-02 10:48:05 +02:00
for ( let type in chartbundleTypesDirect ) {
2020-01-03 21:16:40 +01:00
us . push ( new ol . layer . Tile ( {
source : new ol . source . TileWMS ( {
2020-03-31 00:03:53 +02:00
url : 'https://wms.chartbundle.com/wms' ,
2020-01-03 21:16:40 +01:00
params : { LAYERS : type } ,
projection : 'EPSG:3857' ,
2021-04-27 20:49:50 +02:00
attributions : 'Tiles courtesy of <a href="http://www.chartbundle.com/">ChartBundle</a>' ,
2021-04-28 16:11:24 +02:00
attributionsCollapsible : false ,
2021-04-27 20:49:50 +02:00
maxZoom : 12 , // doesn't work for WMS
2022-07-31 16:16:24 +02:00
transition : tileTransition ,
2020-01-03 21:16:40 +01:00
} ) ,
name : 'chartbundle_' + type ,
2023-05-02 10:48:05 +02:00
title : chartbundleTypesDirect [ type ] ,
2020-01-03 21:16:40 +01:00
type : 'base' ,
group : 'chartbundle' } ) ) ;
}
}
2020-03-02 13:20:12 +01:00
world . push ( new ol . layer . Tile ( {
source : new ol . source . XYZ ( {
"url" : "https://map.adsbexchange.com/mapproxy/tiles/1.0.0/openaip/ul_grid/{z}/{x}/{y}.png" ,
"attributions" : "openAIP.net" ,
2021-04-28 16:11:24 +02:00
attributionsCollapsible : false ,
2021-05-19 18:21:07 +02:00
maxZoom : 12 ,
2022-07-31 16:16:24 +02:00
transition : tileTransition ,
2020-03-02 13:20:12 +01:00
} ) ,
name : 'openaip' ,
title : 'openAIP TMS' ,
type : 'overlay' ,
opacity : 0.7 ,
visible : false ,
zIndex : 99 ,
2021-05-19 18:21:07 +02:00
maxZoom : 13 ,
2020-03-02 13:20:12 +01:00
} ) ) ;
2020-11-12 21:55:28 +01:00
if ( tfrs ) {
world . push ( new ol . layer . Vector ( {
source : new ol . source . Vector ( {
url : 'tfrs.kml' ,
format : new ol . format . KML ( ) ,
2022-07-31 16:16:24 +02:00
transition : tileTransition ,
2020-11-12 21:55:28 +01:00
} ) ,
name : 'tfr' ,
title : 'TFRs' ,
type : 'overlay' ,
opacity : 0.7 ,
visible : true ,
zIndex : 99 ,
} ) ) ;
}
2020-11-12 20:09:36 +01:00
2023-10-14 08:22:29 +02:00
// nexrad and noaa stuff
const bottomLeft = ol . proj . fromLonLat ( [ - 171.0 , 9.0 ] ) ;
const topRight = ol . proj . fromLonLat ( [ - 51.0 , 69.0 ] ) ;
const naExtent = [ bottomLeft [ 0 ] , bottomLeft [ 1 ] , topRight [ 0 ] , topRight [ 1 ] ] ;
2021-07-14 09:34:31 +02:00
if ( true ) {
let nexrad = new ol . layer . Tile ( {
name : 'nexrad' ,
title : 'NEXRAD' ,
type : 'overlay' ,
opacity : 0.35 ,
visible : false ,
zIndex : 99 ,
2023-10-14 08:22:29 +02:00
extent : naExtent ,
2021-07-14 09:34:31 +02:00
} ) ;
let refreshNexrad = function ( ) {
// re-build the source to force a refresh of the nexrad tiles
let now = new Date ( ) . getTime ( ) ;
2022-07-28 12:52:42 +02:00
let nexradSource = new ol . source . XYZ ( {
2021-07-14 09:34:31 +02:00
url : 'https://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="https://mesonet.agron.iastate.edu/">IEM</a>' ,
attributionsCollapsible : false ,
maxZoom : 8 ,
2022-07-28 12:52:42 +02:00
} ) ;
nexrad . setSource ( nexradSource ) ;
2021-07-14 09:34:31 +02:00
} ;
refreshNexrad ( ) ;
window . setInterval ( refreshNexrad , 2 * 60 * 1000 ) ;
2020-01-03 21:16:40 +01:00
2023-10-14 08:22:29 +02:00
us . push ( nexrad ) ;
}
if ( true ) {
2023-08-26 14:12:38 -05:00
let noaaSatSource = new ol . source . ImageWMS ( {
2021-07-14 09:34:31 +02:00
attributions : [ 'NOAA' ] ,
2021-04-28 16:11:24 +02:00
attributionsCollapsible : false ,
2023-08-26 14:12:38 -05:00
url : 'https://nowcoast.noaa.gov/geoserver/satellite/wms' ,
params : { 'LAYERS' : 'global_longwave_imagery_mosaic' } ,
2021-07-14 09:34:31 +02:00
projection : 'EPSG:3857' ,
2022-07-28 12:52:42 +02:00
resolutions : [ 156543.03392804097 , 78271.51696402048 , 39135.75848201024 , 19567.87924100512 , 9783.93962050256 , 4891.96981025128 , 2445.98490512564 , 1222.99245256282 ] ,
ratio : 1 ,
2022-07-31 16:16:24 +02:00
transition : tileTransition ,
2021-07-14 09:34:31 +02:00
} ) ;
2023-10-14 08:22:29 +02:00
2023-08-26 14:12:38 -05:00
let noaaSat = new ol . layer . Image ( {
title : 'NOAA Infrared Sat' ,
name : 'noaa_sat' ,
2021-07-14 09:34:31 +02:00
zIndex : 99 ,
type : 'overlay' ,
visible : false ,
2023-08-26 14:12:38 -05:00
source : noaaSatSource ,
2021-07-14 09:34:31 +02:00
opacity : 0.35 ,
2023-10-14 08:22:29 +02:00
extent : naExtent ,
2021-07-14 09:34:31 +02:00
} ) ;
2023-10-14 08:22:29 +02:00
2023-08-26 14:33:53 -05:00
let refreshNoaaSat = function ( ) {
noaaSatSource . refresh ( ) ;
}
2023-10-14 08:22:29 +02:00
2023-08-26 14:33:53 -05:00
// Refresh sat layer every 15 minutes
refreshNoaaSat ( ) ;
window . setInterval ( refreshNoaaSat , 15 * 60 * 1000 ) ;
2021-07-14 09:34:31 +02:00
2023-08-26 14:12:38 -05:00
us . push ( noaaSat ) ;
2021-07-14 09:34:31 +02:00
}
2023-10-14 08:22:29 +02:00
if ( true ) {
let noaaRadarSource = new ol . source . ImageWMS ( {
attributions : [ 'NOAA' ] ,
attributionsCollapsible : false ,
url : 'https://nowcoast.noaa.gov/geoserver/weather_radar/wms' ,
params : { 'LAYERS' : 'base_reflectivity_mosaic' } ,
projection : 'EPSG:3857' ,
resolutions : [ 156543.03392804097 , 78271.51696402048 , 39135.75848201024 , 19567.87924100512 , 9783.93962050256 , 4891.96981025128 , 2445.98490512564 , 1222.99245256282 ] ,
ratio : 1 ,
transition : tileTransition ,
} ) ;
let noaaRadar = new ol . layer . Image ( {
title : 'NOAA Radar' ,
name : 'noaa_radar' ,
zIndex : 99 ,
type : 'overlay' ,
visible : false ,
source : noaaRadarSource ,
opacity : 0.35 ,
extent : naExtent ,
} ) ;
us . push ( noaaRadar ) ;
}
2020-12-30 03:12:17 +01:00
2020-01-23 20:45:54 +01:00
if ( enableDWD ) {
2021-07-14 09:34:31 +02:00
const bottomLeft = ol . proj . fromLonLat ( [ 1.9 , 46.2 ] ) ;
const topRight = ol . proj . fromLonLat ( [ 16.0 , 55.0 ] ) ;
2023-10-14 08:22:29 +02:00
const dwdExtent = [ bottomLeft [ 0 ] , bottomLeft [ 1 ] , topRight [ 0 ] , topRight [ 1 ] ] ;
2022-07-28 12:52:42 +02:00
let dwdSource = new ol . source . TileWMS ( {
url : 'https://maps.dwd.de/geoserver/wms' ,
params : { LAYERS : dwdLayers , validtime : ( new Date ( ) ) . getTime ( ) } ,
projection : 'EPSG:3857' ,
attributions : 'Deutscher Wetterdienst (DWD)' ,
attributionsCollapsible : false ,
tileGrid : ol . tilegrid . createXYZ ( {
extent : ol . tilegrid . extentFromProjection ( 'EPSG:3857' ) ,
maxResolution : 156543.03392804097 ,
2021-04-27 20:49:50 +02:00
maxZoom : 8 ,
2022-07-28 12:52:42 +02:00
minZoom : 0 ,
tileSize : 256 ,
2020-01-23 20:45:54 +01:00
} ) ,
2022-07-31 16:16:24 +02:00
transition : tileTransition ,
2022-07-28 12:52:42 +02:00
} ) ;
let dwd = new ol . layer . Tile ( {
source : dwdSource ,
2020-01-23 20:45:54 +01:00
name : 'radolan' ,
title : 'DWD RADOLAN' ,
type : 'overlay' ,
opacity : 0.3 ,
2020-03-02 13:20:12 +01:00
visible : false ,
zIndex : 99 ,
2023-10-14 08:22:29 +02:00
extent : dwdExtent ,
2020-01-23 20:45:54 +01:00
} ) ;
2020-03-27 08:45:56 +01:00
let refreshDwd = function ( ) {
2020-01-23 20:45:54 +01:00
dwd . getSource ( ) . updateParams ( { "validtime" : ( new Date ( ) ) . getTime ( ) } ) ;
} ;
refreshDwd ( ) ;
2021-04-27 20:49:50 +02:00
window . setInterval ( refreshDwd , 2 * 60 * 1000 ) ;
2020-03-02 13:20:12 +01:00
europe . push ( dwd ) ;
2020-01-23 20:45:54 +01:00
}
2023-08-26 14:12:38 -05:00
if ( true ) {
const getRainviewerLayers = async function ( key ) {
const response = await fetch ( "https://api.rainviewer.com/public/weather-maps.json" , { credentials : "omit" , } ) ;
const jsonData = await response . json ( ) ;
return jsonData [ key ] ;
}
const rainviewerRadar = new ol . layer . Tile ( {
name : 'rainviewer_radar' ,
title : 'RainViewer Radar' ,
type : 'overlay' ,
opacity : 0.35 ,
visible : false ,
zIndex : 99 ,
} ) ;
const refreshRainviewerRadar = async function ( ) {
const latestLayer = await getRainviewerLayers ( 'radar' ) ;
const rainviewerRadarSource = new ol . source . XYZ ( {
url : 'https://tilecache.rainviewer.com/v2/radar/' + latestLayer . past [ latestLayer . past . length - 1 ] . time + '/512/{z}/{x}/{y}/6/1_1.png' ,
attributions : '<a href="https://www.rainviewer.com/api.html" target="_blank">RainViewer.com</a>' ,
attributionsCollapsible : false ,
maxZoom : 20 ,
} ) ;
rainviewerRadar . setSource ( rainviewerRadarSource ) ;
} ;
2023-10-14 08:22:29 +02:00
2023-08-26 14:12:38 -05:00
refreshRainviewerRadar ( ) ;
window . setInterval ( refreshRainviewerRadar , 2 * 60 * 1000 ) ;
world . push ( rainviewerRadar ) ;
2023-10-14 08:22:29 +02:00
2023-08-26 14:12:38 -05:00
const rainviewerClouds = new ol . layer . Tile ( {
name : 'rainviewer_clouds' ,
title : 'RainViewer Clouds' ,
type : 'overlay' ,
opacity : 0.35 ,
visible : false ,
zIndex : 99 ,
} ) ;
const refreshRainviewerClouds = async function ( ) {
const latestLayer = await getRainviewerLayers ( 'satellite' ) ;
const rainviewerCloudsSource = new ol . source . XYZ ( {
url : 'https://tilecache.rainviewer.com/' + latestLayer . infrared [ latestLayer . infrared . length - 1 ] . path + '/512/{z}/{x}/{y}/0/0_0.png' ,
attributions : '<a href="https://www.rainviewer.com/api.html" target="_blank">RainViewer.com</a>' ,
attributionsCollapsible : false ,
maxZoom : 20 ,
} ) ;
rainviewerClouds . setSource ( rainviewerCloudsSource ) ;
} ;
2023-10-14 08:22:29 +02:00
2023-08-26 14:12:38 -05:00
refreshRainviewerClouds ( ) ;
window . setInterval ( refreshRainviewerClouds , 2 * 60 * 1000 ) ;
world . push ( rainviewerClouds ) ;
}
2020-03-02 13:20:12 +01:00
2020-03-27 08:45:56 +01:00
let createGeoJsonLayer = function ( title , name , url , fill , stroke , showLabel = true ) {
2020-03-01 23:12:41 +00:00
return new ol . layer . Vector ( {
type : 'overlay' ,
title : title ,
name : name ,
2020-03-02 13:20:12 +01:00
zIndex : 99 ,
visible : false ,
2020-03-01 23:12:41 +00:00
source : new ol . source . Vector ( {
2022-07-31 16:16:24 +02:00
url : url ,
transition : tileTransition ,
format : new ol . format . GeoJSON ( {
defaultDataProjection : 'EPSG:4326' ,
2020-03-01 23:12:41 +00:00
projection : 'EPSG:3857'
2022-07-31 16:16:24 +02:00
} )
2020-03-01 23:12:41 +00:00
} ) ,
2021-04-27 20:49:50 +02:00
style : function style ( feature ) {
2020-03-02 23:13:36 +00:00
return new ol . style . Style ( {
2020-03-02 20:14:40 +01:00
fill : new ol . style . Fill ( {
2020-03-02 23:13:36 +00:00
color : fill
2020-03-02 20:14:40 +01:00
} ) ,
stroke : new ol . style . Stroke ( {
2020-03-02 23:13:36 +00:00
color : stroke ,
width : 1
} ) ,
text : new ol . style . Text ( {
2020-03-09 23:31:04 +01:00
text : showLabel ? feature . get ( "name" ) : "" ,
2020-03-02 23:13:36 +00:00
overflow : OLMap . getView ( ) . getZoom ( ) > 5 ,
scale : 1.25 ,
fill : new ol . style . Fill ( {
color : '#000000'
} ) ,
stroke : new ol . style . Stroke ( {
color : '#FFFFFF' ,
width : 2
} )
2020-03-02 20:14:40 +01:00
} )
2020-03-02 23:13:36 +00:00
} ) ;
}
2020-03-01 23:12:41 +00:00
} ) ;
2020-03-02 20:14:40 +01:00
} ;
2023-01-19 07:58:03 +01:00
2023-01-19 06:48:49 +00:00
// Taken from https://www.ais.pansa.pl/mil/pliki/EP_ENR_2_4_en.pdf
europe . push ( createGeoJsonLayer ( 'PL AWACS Orbits' , 'plawacsorbits' , 'geojson/PL_Mil_AWACS_Orbits.geojson' , 'rgba(252, 186, 3, 0.3)' , 'rgba(252, 186, 3, 1)' , false ) ) ;
2020-01-03 21:16:40 +01:00
2023-01-19 06:51:10 +00:00
// Taken from https://english.defensie.nl/binaries/defence/documenten/publications/2022/12/14/milaip-01-23-part-1-gen-part-2-enr/MILAIP_01_2023split_GEN_ENR.pdf
europe . push ( createGeoJsonLayer ( 'NL AWACS Orbits' , 'nlawacsorbits' , 'geojson/NL_Mil_AWACS_Orbits.geojson' , 'rgba(252, 186, 3, 0.3)' , 'rgba(252, 186, 3, 1)' , false ) ) ;
// Taken from https://github.com/olithissen/AwacsOrbitsDE
europe . push ( createGeoJsonLayer ( 'DE AWACS Orbits' , 'deawacsorbits' , 'geojson/DE_Mil_AWACS_Orbits.geojson' , 'rgba(252, 186, 3, 0.3)' , 'rgba(252, 186, 3, 1)' , false ) ) ;
2023-01-19 07:58:03 +01:00
2020-03-01 23:12:41 +00:00
// Taken from https://github.com/alkissack/Dump1090-OpenLayers3-html
2020-03-02 13:20:12 +01:00
europe . push ( createGeoJsonLayer ( 'UK Radar Corridors' , 'ukradarcorridors' , 'geojson/UK_Mil_RC.geojson' , 'rgba(22, 171, 22, 0.3)' , 'rgba(22, 171, 22, 1)' ) ) ;
2020-06-18 08:12:10 +02:00
europe . push ( createGeoJsonLayer ( 'UK A2A Refueling' , 'uka2arefueling' , 'geojson/UK_Mil_AAR_Zones.geojson' , 'rgba(52, 50, 168, 0.3)' , 'rgba(52, 50, 168, 1)' ) ) ;
2023-01-19 06:45:48 +00:00
europe . push ( createGeoJsonLayer ( 'UK AWACS Orbits' , 'ukawacsorbits' , 'geojson/UK_Mil_AWACS_Orbits.geojson' , 'rgba(252, 186, 3, 0.3)' , 'rgba(252, 186, 3, 1)' , false ) ) ;
2020-03-09 22:21:00 +01:00
2020-03-12 17:46:13 +01:00
us . push ( createGeoJsonLayer ( 'US A2A Refueling' , 'usa2arefueling' , 'geojson/US_A2A_refueling.geojson' , 'rgba(52, 50, 168, 0.3)' , 'rgba(52, 50, 168, 1)' ) ) ;
2020-01-03 21:16:40 +01:00
2020-05-23 16:37:47 -04:00
us . push ( createGeoJsonLayer ( 'US ARTCC Boundaries' , 'usartccboundaries' , 'geojson/US_ARTCC_boundaries.geojson' , 'rgba(255, 0, 255, 0.3)' , 'rgba(255, 0, 255, 1)' , false ) ) ;
2022-04-06 21:20:38 +02:00
if ( uk _advisory ) {
europe . push ( createGeoJsonLayer ( 'uka_airports' , 'uka_airports' , 'geojson/uk_advisory/airports.geojson' , 'rgba(255, 255, 255, 1)' , 'rgba(255, 255, 255, 1)' ) ) ;
europe . push ( createGeoJsonLayer ( 'uka_airspaces' , 'uka_airspaces' , 'geojson/uk_advisory/airspaces.geojson' , 'rgba(0, 0, 0, 0.1)' , 'rgba(0, 30, 255, 0.2)' ) ) ;
//europe.push(createGeoJsonLayer('hotspots', 'hotspots', 'geojson/uk_advisory/hotspots.geojson', 'rgba(255, 255, 255, 1)', 'rgba(255, 255, 255, 1)'));
//europe.push(createGeoJsonLayer('navaids', 'navaids', 'geojson/uk_advisory/navaids.geojson', 'rgba(0, 0, 0, 1)', 'rgba(0, 0, 0, 1)'));
europe . push ( createGeoJsonLayer ( 'uka_runways' , 'uka_runways' , 'geojson/uk_advisory/runways.geojson' , 'rgba(0, 0, 0, 0.5)' , 'rgba(0, 0, 0, 0.5)' ) ) ;
europe . push ( createGeoJsonLayer ( 'uka_shoreham' , 'uka_shoreham' , 'geojson/uk_advisory/shoreham.geojson' , 'rgba(0, 0, 0, 0.5)' , 'rgba(0, 0, 0, 0.5)' ) ) ;
}
2020-05-08 21:55:20 +02:00
if ( l3harris ) {
2021-04-23 17:01:56 +02:00
let files = [ 'IFT_NAV_Routes.geojson' , 'IFT_Training_Areas.geojson' , 'USAFA_Training_Areas.geojson' ] ;
for ( let i in files ) {
let name = files [ i ] . split ( '.' ) [ 0 ] ;
us . push ( createGeoJsonLayer ( name , 'ift' + i , 'geojson/IFT/' + files [ i ] , 'rgba(52, 50, 168, 0.3)' , 'rgba(52, 50, 168, 1)' ) ) ;
}
2020-05-08 21:55:20 +02:00
}
2022-05-28 19:35:27 +02:00
layers . push ( new ol . layer . Group ( {
name : 'custom' ,
title : 'Custom' ,
layers : custom _layers ,
} ) ) ;
2020-03-02 13:20:12 +01:00
if ( europe . getLength ( ) > 0 ) {
layers . push ( new ol . layer . Group ( {
name : 'europe' ,
title : 'Europe' ,
layers : new ol . Collection ( europe . getArray ( ) . reverse ( ) ) ,
2021-10-29 21:14:01 +02:00
fold : 'open' ,
2020-02-08 20:32:04 +01:00
} ) ) ;
}
2020-01-03 21:16:40 +01:00
if ( us . getLength ( ) > 0 ) {
layers . push ( new ol . layer . Group ( {
name : 'us' ,
title : 'US' ,
2020-03-02 13:20:12 +01:00
layers : new ol . Collection ( us . getArray ( ) . reverse ( ) ) ,
2021-10-29 21:14:01 +02:00
fold : 'open' ,
2020-01-03 21:16:40 +01:00
} ) ) ;
}
2020-01-23 20:45:54 +01:00
2020-01-03 21:16:40 +01:00
if ( world . getLength ( ) > 0 ) {
layers . push ( new ol . layer . Group ( {
name : 'world' ,
title : 'Worldwide' ,
2020-03-02 13:20:12 +01:00
layers : new ol . Collection ( world . getArray ( ) . reverse ( ) ) ,
//fold: 'open',
2020-03-01 23:12:41 +00:00
} ) ) ;
}
2020-02-29 17:51:42 +01:00
2020-01-23 20:45:54 +01:00
2020-01-03 21:16:40 +01:00
return layers _group ;
}