Skip to content

Commit

Permalink
Handle the case when source parameters + render parameters are both e…
Browse files Browse the repository at this point in the history
…mpty (#1218)

**Related Ticket:** #1028 

### Description of Changes
- It turns out that there are datasets (such as globalscope bluetarp)
that should not have any titiler parameters.
Bluetarp data from stac backend:
https://staging.openveda.cloud/api/stac/collections/blue-tarp-planetscope

### Notes & Questions About Changes
This makes me wonder about if we can validate anything about render
parameters - ex. When there is no render parameter at all from stac
back-end points, is there any way to be sure that this dataset is meant
to be without render parameters ? - Tagging @smohiudd for this question.

### Testing
Test this branch with veda-config's globalscope bluetarp dataset.
  • Loading branch information
hanbyul-here authored Oct 30, 2024
2 parents 0cc5f82 + 86e83fa commit 1046666
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import {
DATA_METRICS,
DEFAULT_DATA_METRICS
} from './components/datasets/analysis-metrics';
import { DEFAULT_COLORMAP } from './components/datasets/colormap-options';
import { utcString2userTzDate } from '$utils/date';
import {
DatasetLayer,
Expand Down Expand Up @@ -64,8 +63,8 @@ function getInitialMetrics(data: DatasetLayer): DataMetric[] {
return foundMetrics;
}

function getInitialColorMap(dataset: DatasetLayer): string {
return dataset.sourceParams?.colormap_name ?? DEFAULT_COLORMAP;
function getInitialColorMap(dataset: DatasetLayer): string|undefined {
return dataset.sourceParams?.colormap_name;
}

export function reconcileDatasets(
Expand Down Expand Up @@ -194,6 +193,10 @@ export function resolveRenderParams(
datasetSourceParams: Record<string, any> | undefined,
queryDataRenders: Record<string, any> | undefined
): Record<string, any> | undefined {
// Return null if there are no user-configured sourcparams nor render parameter
// so it doesn't get subbed with default values
if (!datasetSourceParams && !queryDataRenders) return undefined;

// Start with sourceParams from the dataset.
// Return the source param as it is if exists
if (hasValidSourceParams(datasetSourceParams)) {
Expand Down

0 comments on commit 1046666

Please sign in to comment.