Skip to content

Commit

Permalink
ol-stac migration #531
Browse files Browse the repository at this point in the history
  • Loading branch information
m-mohr committed Jan 25, 2025
1 parent 73cd165 commit 79b3071
Show file tree
Hide file tree
Showing 34 changed files with 1,600 additions and 5,243 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
5 changes: 2 additions & 3 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(asset.href.startsWith("/vsi") ? asset.href : href),
buildTileUrlTemplate: null,
stacProxyUrl: null,
pathPrefix: "/",
historyMode: "history",
Expand All @@ -36,7 +36,6 @@ module.exports = {
showKeywordsInItemCards: false,
showKeywordsInCatalogCards: false,
showThumbnailsAsAssets: false,
geoTiffResolution: 128,
redirectLegacyUrls: false,
itemsPerPage: 12,
defaultThumbnailSize: null,
Expand Down
6 changes: 0 additions & 6 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 Down
Loading

0 comments on commit 79b3071

Please sign in to comment.