Skip to content

Commit

Permalink
Merge pull request #66 from nsidc/change-default-basemap
Browse files Browse the repository at this point in the history
Use USGS topographic imagery basemap by default
  • Loading branch information
mfisher87 authored Mar 6, 2024
2 parents 12839b9 + 4cef940 commit 6a9190f
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 13 deletions.
12 changes: 5 additions & 7 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
# v1.0.0 (Unreleased)
# v0.17.0 (2024-03-06)

* Update expected JSON structures to match new snow-today-webapp-server specifications.
* 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.


## Under the hood
Expand Down
7 changes: 4 additions & 3 deletions src/components/ControlPanel/BasemapSelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 = () => {
Expand All @@ -14,11 +14,12 @@ const BasemapSelector: React.FC = () => {
if (!eventKey) {
return;
}
setSelectedBasemap(eventKey);
// TODO: How to avoid cast?
setSelectedBasemap(eventKey as BasemapTitle);
};
return (
<DropdownButton title={'Select a Basemap'} onSelect={handleSelect}>
{basemapNames.map(basemapName => (
{basemapTitles.map(basemapName => (
<Dropdown.Item
key={basemapName}
eventKey={basemapName}
Expand Down
3 changes: 2 additions & 1 deletion src/state/client/selectedBasemapName.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {atom} from 'jotai';

import {BasemapTitle} from '@src/util/layer/basemaps';

// TODO: Something about this magic string
export const selectedBasemapNameAtom = atom<string>('USGS Topographic');
export const selectedBasemapNameAtom = atom<BasemapTitle>('USGS Topographic + Imagery');
selectedBasemapNameAtom.debugLabel = 'selectedBasemapNameAtom';
23 changes: 21 additions & 2 deletions src/util/layer/basemaps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Check warning on line 32 in src/util/layer/basemaps.ts

View workflow job for this annotation

GitHub Actions / test / Run tests

Unexpected any. Specify a different type
}
interface IBasemapAttrs {
title: string;
title: BasemapTitle;
visible: boolean;
sourceInfo?: ISourceAttrs;
// For when multiple sources must be combined
children?: IBasemapAttrs[];
}

Expand Down Expand Up @@ -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<BasemapTitle> = basemapsInfo.map(
(basemapInfoEntry) => basemapInfoEntry['title']
);

Expand Down

0 comments on commit 6a9190f

Please sign in to comment.