Skip to content

Commit

Permalink
Merge pull request #4853 from wri/fix/TCL-query-FLAG-1193
Browse files Browse the repository at this point in the history
[FLAG-1193] Error in the query of TCL widget within some custom areas
  • Loading branch information
willian-viana authored Sep 23, 2024
2 parents c21d550 + 276def1 commit 28909d2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 2 additions & 0 deletions components/widgets/forest-change/tree-loss/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,8 @@ export default {
threshold: 30,
extentYear: 2000,
ifl: 2000,
startYear: MIN_YEAR,
endYear: MAX_YEAR,
},
getData: (params = {}) => {
const { adm0, adm1, adm2, type } = params || {};
Expand Down
4 changes: 3 additions & 1 deletion services/analysis-cached.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ const SQL_QUERIES = {
treeCoverDensity:
'SELECT {select_location}, wri_tropical_tree_cover__decile, SUM(wri_tropical_tree_cover_extent__ha) AS wri_tropical_tree_cover_extent__ha FROM data {WHERE} AND wri_tropical_tree_cover__decile >= 0 GROUP BY {location}, wri_tropical_tree_cover__decile ORDER BY {location}, wri_tropical_tree_cover__decile',
treeLossOTF:
'SELECT umd_tree_cover_loss__year, SUM(area__ha) FROM data WHERE umd_tree_cover_loss__year >= {startYear} AND umd_tree_cover_loss__year <= {endYear} AND umd_tree_cover_density_2000__threshold >= {threshold} GROUP BY umd_tree_cover_loss__year&geostore_id={geostoreId}',
'SELECT umd_tree_cover_loss__year, SUM(area__ha) FROM data WHERE umd_tree_cover_loss__year >= {startYear} AND umd_tree_cover_loss__year <= {endYear} AND umd_tree_cover_density_{extentYear}__threshold >= {threshold} GROUP BY umd_tree_cover_loss__year&geostore_id={geostoreId}',
treeLossOTFExtent:
'SELECT SUM(area__ha) FROM data WHERE umd_tree_cover_density_2000__threshold >= {threshold}&geostore_id={geostoreId}',
};
Expand Down Expand Up @@ -692,6 +692,7 @@ export const getTreeLossOTF = async (params) => {
geostore,
startYear,
endYear,
extentYear,
threshold,
} = params || {};

Expand All @@ -707,6 +708,7 @@ export const getTreeLossOTF = async (params) => {
.replace('{startYear}', startYear)
.replace('{endYear}', endYear)
.replace('{threshold}', threshold)
.replace('{extentYear}', extentYear)
);
const urlExtent = encodeURI(
`${urlForExtent + sqlExtent}`
Expand Down

0 comments on commit 28909d2

Please sign in to comment.