Skip to content

Commit

Permalink
pasture_vigor_col8 -> pasture_vigor_col9
Browse files Browse the repository at this point in the history
  • Loading branch information
jairomr authored Oct 25, 2024
1 parent f791f4f commit 8a6d7d4
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ export class RightSideBarComponent implements OnInit {

this.layersForStatistics = {
pasture: { year: "year=2023", switch: true, valueType: "pasture_col9_s100" },
pasture_quality: { year: "year=0", switch: false, valueType: "pasture_vigor_col8_s100" },
pasture_quality: { year: "year=0", switch: false, valueType: "pasture_vigor_col9_s100" },
carbono: { year: "year=0", switch: false, valueType: "pa_br_somsc_2022" },
}

Expand Down
6 changes: 3 additions & 3 deletions src/server/database/queries/charts.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ module.exports = function (app) {
source: 'lapig',
id: 'pasture_quality',
sql: " SELECT b.name as classe, b.color, CAST(sum(a.st_area_ha) as double precision) as value "
+ " FROM pasture_vigor_col8 a " + "INNER JOIN graphic_colors as b on cast(a.classe as varchar) = b.class_number AND b.table_rel = 'pasture_quality'"
+ " FROM pasture_vigor_col9 a " + "INNER JOIN graphic_colors as b on cast(a.classe as varchar) = b.class_number AND b.table_rel = 'pasture_quality'"
+ " WHERE " + regionFilter
+ " AND " + yearFilter
+ " GROUP BY 1,2;",
Expand Down Expand Up @@ -152,7 +152,7 @@ module.exports = function (app) {
source: 'lapig',
id: 'pasture_quality',
sql: " SELECT a.year::int as label,b.color, b.name as classe, sum(a.st_area_ha) as value, (SELECT CAST(SUM(pol_ha) / 1000 as double precision) FROM regions WHERE " + regionFilter + ") as area_mun " +
" FROM pasture_vigor_col8 a " + "INNER JOIN graphic_colors as b on cast(a.classe as varchar) = b.class_number AND b.table_rel = 'pasture_quality'" +
" FROM pasture_vigor_col9 a " + "INNER JOIN graphic_colors as b on cast(a.classe as varchar) = b.class_number AND b.table_rel = 'pasture_quality'" +
"WHERE " + regionFilter +
// " AND " + yearFilter +
" GROUP BY 1,2,3 ORDER BY 1 ASC;",
Expand Down Expand Up @@ -190,7 +190,7 @@ module.exports = function (app) {
id: 'pasture_quality',
sql: "SELECT b.name as label, b.color, sum(a.st_area_ha) as value, "
+ "(SELECT CAST(SUM(pol_ha) as double precision) FROM regions WHERE " + regionFilter + ") as area_mun "
+ "FROM pasture_vigor_col8 as A "
+ "FROM pasture_vigor_col9 as A "
+ "INNER JOIN graphic_colors as B on cast(a.classe as varchar) = b.class_number AND b.table_rel = 'pasture_quality' "
+ "WHERE " + regionFilter
+ " AND " + yearFilter
Expand Down
6 changes: 3 additions & 3 deletions src/server/database/queries/upload.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ module.exports = function (app) {
source: 'lapig',
id: 'pasture_quality',
sql: "SELECT p.year as label, b.name as classe, b.color, SUM((ST_Area(safe_intersection(st_transform(p.geom,4674), up.geom)::GEOGRAPHY) / 1000000.0)*100.0) AS value "
+ " FROM pasture_vigor_col8 p "
+ " FROM pasture_vigor_col9 p "
+ " INNER JOIN graphic_colors as b on cast(p.classe as varchar) = b.class_number AND b.table_rel = 'pasture_quality' "
+ " INNER JOIN fdw_general.upload_shapes up on ST_INTERSECTS(ST_TRANSFORM(p.geom,4674), up.geom) where p.year IS NOT NULL "
+ (year ? "AND year = ${year}" : "")
Expand Down Expand Up @@ -129,7 +129,7 @@ module.exports = function (app) {
const token = params['token']
const year = params['year']
const sql = "SELECT p.year, b.name as classe, b.color, SUM((ST_Area(safe_intersection(st_transform(p.geom,4674), up.geom)::GEOGRAPHY) / 1000000.0)*100.0) AS area_pastagem "
+ " FROM pasture_vigor_col8 p "
+ " FROM pasture_vigor_col9 p "
+ " INNER JOIN graphic_colors as b on cast(p.classe as varchar) = b.class_number AND b.table_rel = 'pasture_quality' "
+ " INNER JOIN fdw_general.upload_shapes up on ST_INTERSECTS(ST_TRANSFORM(p.geom,4674), up.geom) where p.year IS NOT NULL "
+ (year ? "AND year = ${year}" : "")
Expand Down Expand Up @@ -170,7 +170,7 @@ module.exports = function (app) {
{
source: 'lapig',
id: 'pasture_quality',
sql: "select distinct year from pasture_vigor_col8 pc order by year asc",
sql: "select distinct year from pasture_vigor_col9 pc order by year asc",
mantain: true
}
]
Expand Down
4 changes: 2 additions & 2 deletions src/server/descriptor/groups/pasture.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
"idLayer": "pasture_quality",
"labelLayer": "translate",
"visible": false,
"selectedType": "pasture_vigor_col8_s100",
"selectedType": "pasture_vigor_col9_s100",
"types": [
"pasture_vigor_col8_s100"
"pasture_vigor_col9_s100"
]
}
]
Expand Down

0 comments on commit 8a6d7d4

Please sign in to comment.