Skip to content

Commit

Permalink
Revert change not to load tiles from GEE
Browse files Browse the repository at this point in the history
  • Loading branch information
clementprdhomme committed Dec 10, 2020
1 parent f7c680d commit 3eb1ae9
Show file tree
Hide file tree
Showing 9 changed files with 36 additions and 81 deletions.
13 changes: 4 additions & 9 deletions api/tiles/land-cover.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,16 +81,11 @@ module.exports = async ({ params: { year, x, y, z } }, res) => {
const image = await getPregeneratedTile(['land-cover', year, z, x, y]);
sendImage(res, image);
} catch (e) {
// Until zoom 5 included, we only retrieve the tiles from the bucket
if (+z <= 5) {
try {
const image = await getOnTheFlyTile(year, x, y, z);
sendImage(res, image);
} catch (e) {
res.status(404).end();
} else {
try {
const image = await getOnTheFlyTile(year, x, y, z);
sendImage(res, image);
} catch (e) {
res.status(404).end();
}
}
}
};
13 changes: 4 additions & 9 deletions api/tiles/soc-experimental-change.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,16 +105,11 @@ module.exports = async ({ params: { type, depth, year1, year2, x, y, z } }, res)

sendImage(res, image);
} catch (e) {
// Until zoom 9 included, we only retrieve the tiles from the bucket
if (+z <= 9) {
try {
const image = await getOnTheFlyTile(type, depth, year1, year2, x, y, z);
sendImage(res, image);
} catch (e) {
res.status(404).end();
} else {
try {
const image = await getOnTheFlyTile(type, depth, year1, year2, x, y, z);
sendImage(res, image);
} catch (e) {
res.status(404).end();
}
}
}
};
13 changes: 4 additions & 9 deletions api/tiles/soc-experimental-timeseries.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,16 +99,11 @@ module.exports = async ({ params: { type, depth, year, x, y, z } }, res) => {

sendImage(res, z, image);
} catch (e) {
// Until zoom 9 included, we only retrieve the tiles from the bucket
if (+z <= 9) {
try {
const image = await getOnTheFlyTile(type, depth, year, x, y, z);
sendImage(res, z, image);
} catch (e) {
res.status(404).end();
} else {
try {
const image = await getOnTheFlyTile(type, depth, year, x, y, z);
sendImage(res, z, image);
} catch (e) {
res.status(404).end();
}
}
}
};
13 changes: 4 additions & 9 deletions api/tiles/soc-stock-future-change.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,16 +107,11 @@ module.exports = async ({ params: { scenario, year, x, y, z } }, res) => {

sendImage(res, image);
} catch (e) {
// Until zoom 5 included, we only retrieve the tiles from the bucket
if (+z <= 5) {
try {
const image = await getOnTheFlyTile(scenario, year, x, y, z);
sendImage(res, image);
} catch (e) {
res.status(404).end();
} else {
try {
const image = await getOnTheFlyTile(scenario, year, x, y, z);
sendImage(res, image);
} catch (e) {
res.status(404).end();
}
}
}
};
13 changes: 4 additions & 9 deletions api/tiles/soc-stock-future-period.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,16 +90,11 @@ module.exports = async ({ params: { scenario, year, x, y, z } }, res) => {

sendImage(res, z, image);
} catch (e) {
// Until zoom 5 included, we only retrieve the tiles from the bucket
if (+z <= 5) {
try {
const image = await getOnTheFlyTile(scenario, year, x, y, z);
sendImage(res, z, image);
} catch (e) {
res.status(404).end();
} else {
try {
const image = await getOnTheFlyTile(scenario, year, x, y, z);
sendImage(res, z, image);
} catch (e) {
res.status(404).end();
}
}
}
};
13 changes: 4 additions & 9 deletions api/tiles/soc-stock-historic-change.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,16 +110,11 @@ module.exports = async ({ params: { depth, x, y, z } }, res) => {

sendImage(res, image);
} catch (e) {
// Until zoom 5 included, we only retrieve the tiles from the bucket
if (+z <= 5) {
try {
const image = await getOnTheFlyTile(depth, x, y, z);
sendImage(res, image);
} catch (e) {
res.status(404).end();
} else {
try {
const image = await getOnTheFlyTile(depth, x, y, z);
sendImage(res, image);
} catch (e) {
res.status(404).end();
}
}
}
};
13 changes: 4 additions & 9 deletions api/tiles/soc-stock-historic-period.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,16 +104,11 @@ module.exports = async ({ params: { depth, period, x, y, z } }, res) => {

sendImage(res, z, image);
} catch (e) {
// Until zoom 5 included, we only retrieve the tiles from the bucket
if (+z <= 5) {
try {
const image = await getOnTheFlyTile(depth, period, x, y, z);
sendImage(res, z, image);
} catch (e) {
res.status(404).end();
} else {
try {
const image = await getOnTheFlyTile(depth, period, x, y, z);
sendImage(res, z, image);
} catch (e) {
res.status(404).end();
}
}
}
};
13 changes: 4 additions & 9 deletions api/tiles/soc-stock-recent-change.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,16 +66,11 @@ module.exports = async ({ params: { year1, year2, x, y, z } }, res) => {

sendImage(res, image);
} catch (e) {
// Until zoom 5 included, we only retrieve the tiles from the bucket
if (+z <= 5) {
try {
const image = await getOnTheFlyTile(year1, year2, x, y, z);
sendImage(res, image);
} catch (e) {
res.status(404).end();
} else {
try {
const image = await getOnTheFlyTile(year1, year2, x, y, z);
sendImage(res, image);
} catch (e) {
res.status(404).end();
}
}
}
};
13 changes: 4 additions & 9 deletions api/tiles/soc-stock-recent-timeseries.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,16 +68,11 @@ module.exports = async ({ params: { year, x, y, z } }, res) => {

sendImage(res, z, image);
} catch (e) {
// Until zoom 5 included, we only retrieve the tiles from the bucket
if (+z <= 5) {
try {
const image = await getOnTheFlyTile(year, x, y, z);
sendImage(res, z, image);
} catch (e) {
res.status(404).end();
} else {
try {
const image = await getOnTheFlyTile(year, x, y, z);
sendImage(res, z, image);
} catch (e) {
res.status(404).end();
}
}
}
};

0 comments on commit 3eb1ae9

Please sign in to comment.