Skip to content

Commit e5b4fe9

Browse files
committed
ol-stac and partial stac-js migration #531 #546
1 parent adfd589 commit e5b4fe9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+1768
-5337
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,8 +169,8 @@ If you need even more flexibility, you need to dig into the Vue files and their
169169
### Basemaps
170170

171171
The file `basemaps.config.js` contains the configuration for the basemaps.
172-
You can update either just the `BASEMAPS` object or you can write a custom function `configureBasemap` that returns the desired options for [vue2-leaflet](https://vue2-leaflet.netlify.app/).
173-
[XYZ](https://vue2-leaflet.netlify.app/components/LTileLayer.html#props) and [WMS](https://vue2-leaflet.netlify.app/components/LWMSTileLayer.html#props) basemaps are supported and have different options that you can set.
172+
You can update either just the `BASEMAPS` object or you can write a custom function `configureBasemap` that returns the desired options for OpenLayers.
173+
XYZ and WMS basemaps are supported and have different options that you can set.
174174

175175
### Actions
176176

basemaps.config.js

Lines changed: 61 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,62 +1,69 @@
1-
import { CRS } from 'leaflet';
21
import STAC from './src/models/stac';
32
import Utils from './src/utils';
43

54
const USGS_ATTRIBUTION = 'USGS Astrogeology';
6-
const WMS = 'LWMSTileLayer';
7-
const XYZ = 'LTileLayer';
5+
const WMS = 'TileWMS';
6+
const XYZ = 'XYZ';
87

8+
// All options (except for 'is') follow the OpenLayers options for the respective source class.
99
const BASEMAPS = {
10-
earth: {
11-
url: 'https://tile.openstreetmap.org/{z}/{x}/{y}.png',
12-
name: 'OpenStreetMap',
13-
is: XYZ,
14-
attribution: '&copy; <a href="https://www.openstreetmap.org/copyright" target="_blank">OpenStreetMap</a> contributors.'
15-
},
16-
europa: {
17-
baseUrl: 'https://planetarymaps.usgs.gov/cgi-bin/mapserv?map=/maps/jupiter/europa_simp_cyl.map',
18-
is: WMS,
19-
name: 'USGS Europa',
20-
attribution: USGS_ATTRIBUTION,
21-
crs: CRS.EPSG4326,
22-
format: 'image/png',
23-
layers: 'GALILEO_VOYAGER'
24-
},
25-
mars: {
26-
baseUrl: 'https://planetarymaps.usgs.gov/cgi-bin/mapserv?map=/maps/mars/mars_simp_cyl.map',
27-
is: WMS,
28-
name: 'USGS Mars',
29-
attribution: USGS_ATTRIBUTION,
30-
crs: CRS.EPSG4326,
31-
format: 'image/png',
32-
layers: 'MDIM21'
33-
},
34-
moon: {
35-
baseUrl: 'https://planetarymaps.usgs.gov/cgi-bin/mapserv?map=/maps/earth/moon_simp_cyl.map',
36-
is: WMS,
37-
name: 'USGS Moon',
38-
attribution: USGS_ATTRIBUTION,
39-
crs: CRS.EPSG4326,
40-
format: 'image/png',
41-
layers: 'LROC_WAC'
42-
}
10+
earth: [
11+
{
12+
url: 'https://tile.openstreetmap.org/{z}/{x}/{y}.png',
13+
is: XYZ,
14+
title: 'OpenStreetMap',
15+
attributions: '&copy; <a href="https://www.openstreetmap.org/copyright" target="_blank">OpenStreetMap</a> contributors.',
16+
projection: "EPSG:3857"
17+
}
18+
],
19+
europa: [
20+
{
21+
url: 'https://planetarymaps.usgs.gov/cgi-bin/mapserv?map=/maps/jupiter/europa_simp_cyl.map',
22+
is: WMS,
23+
title: 'USGS Europa',
24+
attributions: USGS_ATTRIBUTION,
25+
projection: "EPSG:4326",
26+
params: {
27+
FORMAT: 'image/png',
28+
LAYERS: 'GALILEO_VOYAGER'
29+
}
30+
},
31+
],
32+
mars: [
33+
{
34+
url: 'https://planetarymaps.usgs.gov/cgi-bin/mapserv?map=/maps/mars/mars_simp_cyl.map',
35+
is: WMS,
36+
title: 'USGS Mars',
37+
attributions: USGS_ATTRIBUTION,
38+
projection: "EPSG:4326",
39+
params: {
40+
FORMAT: 'image/png',
41+
LAYERS: 'MDIM21'
42+
}
43+
}
44+
],
45+
moon: [
46+
{
47+
url: 'https://planetarymaps.usgs.gov/cgi-bin/mapserv?map=/maps/earth/moon_simp_cyl.map',
48+
is: WMS,
49+
title: 'USGS Moon',
50+
attributions: USGS_ATTRIBUTION,
51+
projection: "EPSG:4326",
52+
params: {
53+
FORMAT: 'image/png',
54+
LAYERS: 'LROC_WAC'
55+
}
56+
}
57+
],
4358
};
4459

45-
/**
46-
* @typedef BasemapOptions
47-
* @type {Object}
48-
* @property {string} is Component: LWMSTileLayer or LTileLayer
49-
* @see https://vue2-leaflet.netlify.app/components/
50-
*/
51-
5260
/**
5361
*
5462
* @param {Object} stac The STAC object
55-
* @param {Object} map The Leaflet map object
5663
* @param {Object} i18n Vue I18N object
5764
* @returns {Array.<BasemapOptions>}
5865
*/
59-
export default function configureBasemap(stac, map, i18n) {
66+
export default function configureBasemap(stac, i18n) {
6067
let targets = ['earth'];
6168
if (stac instanceof STAC) {
6269
if (stac.isCollection() && Utils.isObject(stac.summaries) && Array.isArray(stac.summaries['ssys:targets'])) {
@@ -70,5 +77,13 @@ export default function configureBasemap(stac, map, i18n) {
7077
}
7178
}
7279

73-
return targets.map(target => BASEMAPS[target.toLowerCase()]);
80+
let layers = [];
81+
for (const target of targets) {
82+
const maps = BASEMAPS[target.toLowerCase()];
83+
if (!Array.isArray(maps)) {
84+
continue;
85+
}
86+
layers = layers.concat(maps);
87+
}
88+
return layers;
7489
};

config.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ module.exports = {
2525
// "pt-BR"
2626
],
2727
apiCatalogPriority: null,
28-
useTileLayerAsFallback: true,
28+
useTileLayerAsFallback: false,
2929
displayGeoTiffByDefault: false,
30-
buildTileUrlTemplate: ({href, asset}) => "https://tiles.rdnt.io/tiles/{z}/{x}/{y}@2x?url=" + encodeURIComponent(href),
30+
buildTileUrlTemplate: null,
3131
stacProxyUrl: null,
3232
pathPrefix: "/",
3333
historyMode: "history",
@@ -36,11 +36,9 @@ module.exports = {
3636
showKeywordsInItemCards: false,
3737
showKeywordsInCatalogCards: false,
3838
showThumbnailsAsAssets: false,
39-
geoTiffResolution: 128,
4039
redirectLegacyUrls: false,
4140
itemsPerPage: 12,
4241
defaultThumbnailSize: null,
43-
maxPreviewsOnMap: 50,
4442
crossOriginMedia: null,
4543
requestHeaders: {},
4644
requestQueryParameters: {},

config.schema.json

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -152,12 +152,6 @@
152152
"boolean"
153153
]
154154
},
155-
"geoTiffResolution": {
156-
"type": [
157-
"integer"
158-
],
159-
"minimum": 1
160-
},
161155
"redirectLegacyUrls": {
162156
"type": [
163157
"boolean"
@@ -182,12 +176,6 @@
182176
]
183177
}
184178
},
185-
"maxPreviewsOnMap": {
186-
"type": [
187-
"integer"
188-
],
189-
"minimum": 1
190-
},
191179
"crossOriginMedia": {
192180
"type": [
193181
"string",

docs/options.md

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ The following ways to set config options are possible:
3535
- [displayGeoTiffByDefault](#displaygeotiffbydefault)
3636
- [redirectLegacyUrls](#redirectlegacyurls)
3737
- [itemsPerPage](#itemsperpage)
38-
- [maxPreviewsOnMap](#maxpreviewsonmap)
3938
- [cardViewMode](#cardviewmode)
4039
- [cardViewSort](#cardviewsort)
4140
- [showKeywordsInItemCards](#showkeywordsinitemcards)
@@ -237,10 +236,6 @@ If you are updating from on old version of STAC Browser, you can set this option
237236

238237
The number of items requested and shown per page by default. Only applies to APIs that support the `limit` query parameter.
239238

240-
## maxPreviewsOnMap
241-
242-
The maximum number of previews (thumbnails or overviews) of items that will be shown on the map when on Catalog or Collection pages.
243-
244239
## cardViewMode
245240

246241
The default view mode for lists of catalogs/collections. Either `"list"` or `"cards"` (default).

0 commit comments

Comments
 (0)