Skip to content

Commit

Permalink
ol-stac and partial stac-js migration #531 #546
Browse files Browse the repository at this point in the history
  • Loading branch information
m-mohr committed Jan 26, 2025
1 parent eddcc2c commit 0e333cb
Show file tree
Hide file tree
Showing 43 changed files with 1,698 additions and 5,344 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,8 @@ If you need even more flexibility, you need to dig into the Vue files and their
### Basemaps

The file `basemaps.config.js` contains the configuration for the basemaps.
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/).
[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.
You can update either just the `BASEMAPS` object or you can write a custom function `configureBasemap` that returns the desired options for OpenLayers.
XYZ and WMS basemaps are supported and have different options that you can set.

### Actions

Expand Down
61 changes: 30 additions & 31 deletions basemaps.config.js
Original file line number Diff line number Diff line change
@@ -1,58 +1,57 @@
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 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',
name: 'OpenStreetMap',
title: 'OpenStreetMap',
is: XYZ,
attribution: '&copy; <a href="https://www.openstreetmap.org/copyright" target="_blank">OpenStreetMap</a> contributors.'
attributions: '&copy; <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',
url: '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'
title: 'USGS Europa',
attributions: USGS_ATTRIBUTION,
projection: "EPSG:4326",
params: {
FORMAT: 'image/png',
LAYERS: 'GALILEO_VOYAGER'
}
},
mars: {
baseUrl: 'https://planetarymaps.usgs.gov/cgi-bin/mapserv?map=/maps/mars/mars_simp_cyl.map',
url: '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'
title: 'USGS Mars',
attributions: USGS_ATTRIBUTION,
projection: "EPSG:4326",
params: {
FORMAT: 'image/png',
LAYERS: 'MDIM21'
}
},
moon: {
baseUrl: 'https://planetarymaps.usgs.gov/cgi-bin/mapserv?map=/maps/earth/moon_simp_cyl.map',
url: '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'
title: 'USGS Moon',
attributions: USGS_ATTRIBUTION,
projection: "EPSG:4326",
params: {
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} map The OL map object
* @param {Object} i18n Vue I18N object
* @returns {Array.<BasemapOptions>}
*/
Expand Down
6 changes: 2 additions & 4 deletions config.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ module.exports = {
// "pt-BR"
],
apiCatalogPriority: null,
useTileLayerAsFallback: true,
useTileLayerAsFallback: false,
displayGeoTiffByDefault: false,
buildTileUrlTemplate: ({href, asset}) => "https://tiles.rdnt.io/tiles/{z}/{x}/{y}@2x?url=" + encodeURIComponent(href),
buildTileUrlTemplate: null,
stacProxyUrl: null,
pathPrefix: "/",
historyMode: "history",
Expand All @@ -36,11 +36,9 @@ module.exports = {
showKeywordsInItemCards: false,
showKeywordsInCatalogCards: false,
showThumbnailsAsAssets: false,
geoTiffResolution: 128,
redirectLegacyUrls: false,
itemsPerPage: 12,
defaultThumbnailSize: null,
maxPreviewsOnMap: 50,
crossOriginMedia: null,
requestHeaders: {},
requestQueryParameters: {},
Expand Down
12 changes: 0 additions & 12 deletions config.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -152,12 +152,6 @@
"boolean"
]
},
"geoTiffResolution": {
"type": [
"integer"
],
"minimum": 1
},
"redirectLegacyUrls": {
"type": [
"boolean"
Expand All @@ -182,12 +176,6 @@
]
}
},
"maxPreviewsOnMap": {
"type": [
"integer"
],
"minimum": 1
},
"crossOriginMedia": {
"type": [
"string",
Expand Down
5 changes: 0 additions & 5 deletions docs/options.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ The following ways to set config options are possible:
- [displayGeoTiffByDefault](#displaygeotiffbydefault)
- [redirectLegacyUrls](#redirectlegacyurls)
- [itemsPerPage](#itemsperpage)
- [maxPreviewsOnMap](#maxpreviewsonmap)
- [cardViewMode](#cardviewmode)
- [cardViewSort](#cardviewsort)
- [showKeywordsInItemCards](#showkeywordsinitemcards)
Expand Down Expand Up @@ -237,10 +236,6 @@ If you are updating from on old version of STAC Browser, you can set this option

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

## maxPreviewsOnMap

The maximum number of previews (thumbnails or overviews) of items that will be shown on the map when on Catalog or Collection pages.

## cardViewMode

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

0 comments on commit 0e333cb

Please sign in to comment.