diff --git a/api/tiles/land-cover.js b/api/tiles/land-cover.js index 0d0d2e1..88cc4dd 100644 --- a/api/tiles/land-cover.js +++ b/api/tiles/land-cover.js @@ -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(); - } } } }; diff --git a/api/tiles/soc-experimental-change.js b/api/tiles/soc-experimental-change.js index 68220a5..00426c9 100644 --- a/api/tiles/soc-experimental-change.js +++ b/api/tiles/soc-experimental-change.js @@ -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(); - } } } }; diff --git a/api/tiles/soc-experimental-timeseries.js b/api/tiles/soc-experimental-timeseries.js index 1a4a049..d93b979 100644 --- a/api/tiles/soc-experimental-timeseries.js +++ b/api/tiles/soc-experimental-timeseries.js @@ -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(); - } } } }; diff --git a/api/tiles/soc-stock-future-change.js b/api/tiles/soc-stock-future-change.js index 631d311..234fee4 100644 --- a/api/tiles/soc-stock-future-change.js +++ b/api/tiles/soc-stock-future-change.js @@ -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(); - } } } }; diff --git a/api/tiles/soc-stock-future-period.js b/api/tiles/soc-stock-future-period.js index 98b46ae..9c033fd 100644 --- a/api/tiles/soc-stock-future-period.js +++ b/api/tiles/soc-stock-future-period.js @@ -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(); - } } } }; diff --git a/api/tiles/soc-stock-historic-change.js b/api/tiles/soc-stock-historic-change.js index fac6aee..5cff0ef 100644 --- a/api/tiles/soc-stock-historic-change.js +++ b/api/tiles/soc-stock-historic-change.js @@ -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(); - } } } }; diff --git a/api/tiles/soc-stock-historic-period.js b/api/tiles/soc-stock-historic-period.js index 194174d..13b71b0 100644 --- a/api/tiles/soc-stock-historic-period.js +++ b/api/tiles/soc-stock-historic-period.js @@ -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(); - } } } }; diff --git a/api/tiles/soc-stock-recent-change.js b/api/tiles/soc-stock-recent-change.js index 6fe4d85..5a327f9 100644 --- a/api/tiles/soc-stock-recent-change.js +++ b/api/tiles/soc-stock-recent-change.js @@ -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(); - } } } }; diff --git a/api/tiles/soc-stock-recent-timeseries.js b/api/tiles/soc-stock-recent-timeseries.js index fa3048e..60aaffa 100644 --- a/api/tiles/soc-stock-recent-timeseries.js +++ b/api/tiles/soc-stock-recent-timeseries.js @@ -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(); - } } } };