From 317405d4f69c0a17c16bce70b4cfcb361177f5f7 Mon Sep 17 00:00:00 2001 From: Matt Fisher Date: Wed, 6 Mar 2024 10:47:35 -0700 Subject: [PATCH 1/4] Use USGS topographic imagery basemap by default Improve type annotations while I'm in there --- .../ControlPanel/BasemapSelector.tsx | 7 +++--- src/state/client/selectedBasemapName.ts | 3 ++- src/util/layer/basemaps.ts | 23 +++++++++++++++++-- 3 files changed, 27 insertions(+), 6 deletions(-) diff --git a/src/components/ControlPanel/BasemapSelector.tsx b/src/components/ControlPanel/BasemapSelector.tsx index 96d6493..f2bb35f 100644 --- a/src/components/ControlPanel/BasemapSelector.tsx +++ b/src/components/ControlPanel/BasemapSelector.tsx @@ -4,7 +4,7 @@ import {useAtom} from 'jotai'; import Dropdown from 'react-bootstrap/Dropdown'; import DropdownButton from 'react-bootstrap/DropdownButton'; -import {basemapNames} from '@src/util/layer/basemaps'; +import {basemapTitles, BasemapTitle} from '@src/util/layer/basemaps'; import {selectedBasemapNameAtom} from '@src/state/client/selectedBasemapName'; const BasemapSelector: React.FC = () => { @@ -14,11 +14,12 @@ const BasemapSelector: React.FC = () => { if (!eventKey) { return; } - setSelectedBasemap(eventKey); + // TODO: How to avoid cast? + setSelectedBasemap(eventKey as BasemapTitle); }; return ( - {basemapNames.map(basemapName => ( + {basemapTitles.map(basemapName => ( ('USGS Topographic'); +export const selectedBasemapNameAtom = atom('USGS Topographic + Imagery'); selectedBasemapNameAtom.debugLabel = 'selectedBasemapNameAtom'; diff --git a/src/util/layer/basemaps.ts b/src/util/layer/basemaps.ts index e6faed5..35eaf7d 100644 --- a/src/util/layer/basemaps.ts +++ b/src/util/layer/basemaps.ts @@ -12,14 +12,30 @@ import { } from './source'; +// TODO: Don't use titles as IDs anymore (NOTE: We're not using the source ID +// because those aren't necessarily unique) +export type BasemapTitle = + | "USGS Topographic" + | "USGS Topographic + Imagery" + | "USGS Imagery" + | "USGS Shaded Relief" + | "USGS Hydro Cached" + | "ArcGIS Dark Gray" + | "ArcGIS Dark Gray Reference" // TODO: Remove? + | "ArcGIS Dark Gray Base" // TODO: Remove? + | "ArcGIS Dark Gray - Base only" + | "ArcGIS National Geographic" + | "ArcGIS World Topographic" + interface ISourceAttrs { id: string; fn: (id: any) => XYZ; } interface IBasemapAttrs { - title: string; + title: BasemapTitle; visible: boolean; sourceInfo?: ISourceAttrs; + // For when multiple sources must be combined children?: IBasemapAttrs[]; } @@ -146,7 +162,10 @@ const basemapsInfo: IBasemapAttrs[] = [ visible: false, }, ]; -export const basemapNames = basemapsInfo.map( + +// NOTE: Children are not included here. Could probably use clearer +// nomenclature. +export const basemapTitles: Array = basemapsInfo.map( (basemapInfoEntry) => basemapInfoEntry['title'] ); From 2ca714335df8d7b6487108c60ca01f8099835009 Mon Sep 17 00:00:00 2001 From: Matt Fisher Date: Wed, 6 Mar 2024 10:50:08 -0700 Subject: [PATCH 2/4] CHANGELOG --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0926cc3..00705e6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ * Legends are now displayed at the bottom of the map instead of as a draggable and resizable element within the map viewport. * Display sensor/platform/algorithm in variable selectors. + * Default basemap is now _USGS Topographic + Imagery_ ## Under the hood From 5d8b13ea3112ad71ccd5f82f4b65e7b18accb185 Mon Sep 17 00:00:00 2001 From: Matt Fisher Date: Wed, 6 Mar 2024 10:51:23 -0700 Subject: [PATCH 3/4] Fix CHANGELOG link --- CHANGELOG.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 00705e6..f04b6f9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ # v1.0.0 (Unreleased) -* Update expected JSON structures to match new snow-today-webapp-server specifications. +* Update expected JSON structures to match + [new snow-today-webapp-server specifications](https://snow-today-webapp-server.readthedocs.io/interfaces/). * Support arbitrary nesting of sub-regions specified in server-side data. * Update appearance * New Super Region splash selector on first launch of application. From 4cef9405d2e8b77e8081bdc2adb29e9203625053 Mon Sep 17 00:00:00 2001 From: Matt Fisher Date: Wed, 6 Mar 2024 10:52:57 -0700 Subject: [PATCH 4/4] Update CHANGELOG version -> v0.17.0 --- CHANGELOG.md | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f04b6f9..3ac7025 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,14 +1,10 @@ -# v1.0.0 (Unreleased) +# v0.17.0 (2024-03-06) +* Display sensor/platform/algorithm in variable selectors. +* Default basemap is now _USGS Topographic + Imagery_ * Update expected JSON structures to match [new snow-today-webapp-server specifications](https://snow-today-webapp-server.readthedocs.io/interfaces/). * Support arbitrary nesting of sub-regions specified in server-side data. -* Update appearance - * New Super Region splash selector on first launch of application. - * Legends are now displayed at the bottom of the map instead of as a draggable and - resizable element within the map viewport. - * Display sensor/platform/algorithm in variable selectors. - * Default basemap is now _USGS Topographic + Imagery_ ## Under the hood