forked from radiantearth/stac-browser
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbasemaps.config.js
More file actions
84 lines (80 loc) · 2.06 KB
/
basemaps.config.js
File metadata and controls
84 lines (80 loc) · 2.06 KB
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
74
75
76
77
78
79
80
81
82
83
84
import { Collection } from './src/models/stac';
import { STAC } from 'stac-js';
// For documentation see https://github.com/radiantearth/stac-browser/blob/main/docs/basemaps.md
const BASEMAPS = {
earth: [
{
url: 'https://tile.openstreetmap.org/{z}/{x}/{y}.png',
is: 'XYZ',
title: 'OpenStreetMap',
attributions: '© <a href="https://www.openstreetmap.org/copyright" target="_blank">OpenStreetMap</a> contributors.',
projection: "EPSG:3857"
}
],
europa: [
{
url: 'https://planetarymaps.usgs.gov/cgi-bin/mapserv?map=/maps/jupiter/europa_simp_cyl.map',
is: 'TileWMS',
title: 'USGS Europa',
attributions: 'USGS Astrogeology',
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: 'TileWMS',
title: 'USGS Mars',
attributions: 'USGS Astrogeology',
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: 'TileWMS',
title: 'USGS Moon',
attributions: 'USGS Astrogeology',
projection: 'EPSG:4326',
params: {
FORMAT: 'image/png',
LAYERS: 'LROC_WAC'
}
}
],
};
/**
*
* @param {Object} stac The STAC object
* @param {Object} i18n Vue I18N object
* @returns {Array.<BasemapOptions>}
*/
export default function configureBasemap(stac, i18n) {
let targets;
if (stac instanceof Collection) {
targets = stac.getSummary('ssys:targets');
}
if (stac instanceof STAC && !targets) {
targets = stac.getMetadata('ssys:targets');
}
if (!targets) {
targets = ['earth'];
}
let layers = [];
for (const target of targets) {
const maps = BASEMAPS[target.toLowerCase()];
if (!Array.isArray(maps)) {
continue;
}
layers = layers.concat(maps);
}
return layers;
};