-
Notifications
You must be signed in to change notification settings - Fork 140
/
basemaps.config.js
74 lines (69 loc) · 2.15 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
74
import { CRS } from 'leaflet';
import STAC from './src/models/stac';
import Utils from './src/utils';
const USGS_ATTRIBUTION = 'USGS Astrogeology';
const WMS = 'LWMSTileLayer';
const XYZ = 'LTileLayer';
const BASEMAPS = {
earth: {
url: 'https://tile.openstreetmap.org/{z}/{x}/{y}.png',
name: 'OpenStreetMap',
is: XYZ,
attribution: '© <a href="https://www.openstreetmap.org/copyright" target="_blank">OpenStreetMap</a> contributors.'
},
europa: {
baseUrl: 'https://planetarymaps.usgs.gov/cgi-bin/mapserv?map=/maps/jupiter/europa_simp_cyl.map',
is: WMS,
name: 'USGS Europa',
attribution: USGS_ATTRIBUTION,
crs: CRS.EPSG4326,
format: 'image/png',
layers: 'GALILEO_VOYAGER'
},
mars: {
baseUrl: 'https://planetarymaps.usgs.gov/cgi-bin/mapserv?map=/maps/mars/mars_simp_cyl.map',
is: WMS,
name: 'USGS Mars',
attribution: USGS_ATTRIBUTION,
crs: CRS.EPSG4326,
format: 'image/png',
layers: 'MDIM21'
},
moon: {
baseUrl: 'https://planetarymaps.usgs.gov/cgi-bin/mapserv?map=/maps/earth/moon_simp_cyl.map',
is: WMS,
name: 'USGS Moon',
attribution: USGS_ATTRIBUTION,
crs: CRS.EPSG4326,
format: 'image/png',
layers: 'LROC_WAC'
}
};
/**
* @typedef BasemapOptions
* @type {Object}
* @property {string} is Component: LWMSTileLayer or LTileLayer
* @see https://vue2-leaflet.netlify.app/components/
*/
/**
*
* @param {Object} stac The STAC object
* @param {Object} map The Leaflet 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()]);
};