Skip to content

Commit

Permalink
Merge pull request #18 from nasa-gibs/wv-2159
Browse files Browse the repository at this point in the history
WV-2159 & WV-2160
  • Loading branch information
Tomcariello committed May 3, 2023
2 parents a854c79 + e97f69c commit cabf2f0
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
19 changes: 18 additions & 1 deletion docs/javascript/components.js
Original file line number Diff line number Diff line change
Expand Up @@ -223,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 @@ -236,8 +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}` : ``
return baseUrl + params;
return baseUrl + params + projectionParam;
}
},
mounted: function () {
Expand Down
2 changes: 1 addition & 1 deletion docs/javascript/imagery-products.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const getResolution = ({ projections, type }) => {
*/
const getProjections = (layer) => {
const projections = Object.keys(layer.projections);
if (layer.type !== "vector")
if (layer.type !== "vector" && layer.projections.hasOwnProperty("geographic"))
projections.unshift("web mercator");
return projections;
}
Expand Down

0 comments on commit cabf2f0

Please sign in to comment.