Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use USGS topographic imagery basemap by default #66

Merged
merged 4 commits into from
Mar 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@
} 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 / 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 @@
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
Loading