-
Notifications
You must be signed in to change notification settings - Fork 155
/
Copy pathbasemaps.config.js
73 lines (69 loc) · 2.11 KB
/
basemaps.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
import STAC from './src/models/stac';
import Utils from './src/utils';
const USGS_ATTRIBUTION = 'USGS Astrogeology';
const WMS = 'TileWMS';
const XYZ = 'XYZ';
// All options (except for 'is') follow the OpenLayers options for the respective source class.
const BASEMAPS = {
earth: {
url: 'https://tile.openstreetmap.org/{z}/{x}/{y}.png',
title: 'OpenStreetMap',
is: XYZ,
attributions: '© <a href="https://www.openstreetmap.org/copyright" target="_blank">OpenStreetMap</a> contributors.'
},
europa: {
url: 'https://planetarymaps.usgs.gov/cgi-bin/mapserv?map=/maps/jupiter/europa_simp_cyl.map',
is: WMS,
title: 'USGS Europa',
attributions: USGS_ATTRIBUTION,
projection: "EPSG:4326",
params: {
FORMAT: 'image/png',
LAYERS: 'GALILEO_VOYAGER'
}
},
mars: {
url: 'https://planetarymaps.usgs.gov/cgi-bin/mapserv?map=/maps/mars/mars_simp_cyl.map',
is: WMS,
title: 'USGS Mars',
attributions: USGS_ATTRIBUTION,
projection: "EPSG:4326",
params: {
FORMAT: 'image/png',
LAYERS: 'MDIM21'
}
},
moon: {
url: 'https://planetarymaps.usgs.gov/cgi-bin/mapserv?map=/maps/earth/moon_simp_cyl.map',
is: WMS,
title: 'USGS Moon',
attributions: USGS_ATTRIBUTION,
projection: "EPSG:4326",
params: {
FORMAT: 'image/png',
LAYERS: 'LROC_WAC'
}
}
};
/**
*
* @param {Object} stac The STAC object
* @param {Object} map The OL map object
* @param {Object} i18n Vue I18N object
* @returns {Array.<BasemapOptions>}
*/
export default function configureBasemap(stac, map, i18n) {
let targets = ['earth'];
if (stac instanceof STAC) {
if (stac.isCollection() && Utils.isObject(stac.summaries) && Array.isArray(stac.summaries['ssys:targets'])) {
targets = stac.summaries['ssys:targets'];
}
else if (stac.isCollection() && Array.isArray(stac['ssys:targets'])) {
targets = stac['ssys:targets'];
}
else if (stac.isItem() && Array.isArray(stac.properties['ssys:targets'])) {
targets = stac.properties['ssys:targets'];
}
}
return targets.map(target => BASEMAPS[target.toLowerCase()]);
};