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

WV-2159 & WV-2160 #18

Merged
merged 2 commits into from
May 3, 2023
Merged
Changes from 1 commit
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
Prev Previous commit
Added logic to append the correct projection parameter to the URL.
  • Loading branch information
Tomcariello committed May 2, 2023
commit e97f69c27246628e55204e8f90848ea6fe250fff
21 changes: 18 additions & 3 deletions docs/javascript/components.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ Vue.component('layer-table', {
},
data: function () {
const { layers } = this.measurement;
console.log(layers);
const defaultRenderer = {
props: ['layer', 'property', 'url'],
template: `<span> {{ layer[property] }} </span>`
Expand Down Expand Up @@ -224,6 +223,22 @@ Vue.component('layer-table', {
newDate.setDate(newDate.getDate() + days);
return newDate;
}
const getProjectionParam = (projections) => {
const isGeographic = projections.includes("geographic");
const isArctic = projections.includes("arctic");
const isAntarctic = projections.includes("antarctic");

switch (true) {
case isGeographic:
return "";
case isArctic:
return "&p=arctic";
case isAntarctic:
return "&p=antarctic";
default:
break;
}
}
if (startDate) {
const newStartDate = addDays(startDate, 1);
date = newStartDate.toISOString().split('T')[0]
Expand All @@ -237,9 +252,9 @@ Vue.component('layer-table', {
]
const layerString = layers.join(',');
const baseUrl = `https://worldview.earthdata.nasa.gov/?l=${layerString}`
const projectionParam = getProjectionParam(layer.projections);
const params = startDate ? `&t=${date}` : ``
console.log(baseUrl + params);
return baseUrl + params;
return baseUrl + params + projectionParam;
}
},
mounted: function () {
Expand Down