diff --git a/src/client/src/app/components/general-map/general-map.component.ts b/src/client/src/app/components/general-map/general-map.component.ts index 9344760..1306a13 100755 --- a/src/client/src/app/components/general-map/general-map.component.ts +++ b/src/client/src/app/components/general-map/general-map.component.ts @@ -1167,7 +1167,7 @@ export class GeneralMapComponent implements OnInit, Ruler, AfterContentChecked { const name = this.getFileName(parameters); - const zipCsvLayers = ['pasture_vigor_col8_s100', 'pasture_col8_s100']; + const zipCsvLayers = ['pasture_vigor_col9_s100', 'pasture_col9_s100']; const extension = (zipCsvLayers.includes(layer.valueType) && !(parameters.region.type === 'city')) ? '.zip' : '.csv'; diff --git a/src/client/src/app/components/right-side-bar/right-side-bar.component.ts b/src/client/src/app/components/right-side-bar/right-side-bar.component.ts index 935cd1c..89010f4 100755 --- a/src/client/src/app/components/right-side-bar/right-side-bar.component.ts +++ b/src/client/src/app/components/right-side-bar/right-side-bar.component.ts @@ -124,11 +124,11 @@ export class RightSideBarComponent implements OnInit { this.selectRegion = this.defaultRegion; - this.filterSelectedOnLayersForStatistics = "year=2022" + this.filterSelectedOnLayersForStatistics = "year=2023" this.layersForStatistics = { - pasture: { year: "year=2022", switch: true, valueType: "pasture_col8_s100" }, + pasture: { year: "year=2023", switch: true, valueType: "pasture_col9_s100" }, pasture_quality: { year: "year=0", switch: false, valueType: "pasture_vigor_col8_s100" }, carbono: { year: "year=0", switch: false, valueType: "pa_br_somsc_2022" }, } diff --git a/src/server/database/queries/charts.js b/src/server/database/queries/charts.js index 9000c77..68238fa 100755 --- a/src/server/database/queries/charts.js +++ b/src/server/database/queries/charts.js @@ -60,7 +60,7 @@ module.exports = function (app) { source: 'lapig', id: 'pasture', sql: " SELECT CAST(sum(a.st_area_ha) as double precision) as value " - + " FROM pasture_col8 a " + + " FROM pasture_col9 a " + " WHERE " + regionFilter + " AND " + yearFilter, mantain: true @@ -83,7 +83,7 @@ module.exports = function (app) { avg(value_mean) as mean, (avg(value_mean) * ( SELECT sum(area_ha) - FROM pasture_col8 + FROM pasture_col9 WHERE ${regionFilter} AND ${yearFilter}) ) as total @@ -132,7 +132,7 @@ module.exports = function (app) { id: 'pasture', 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) as double precision) FROM new_regions WHERE " + regionFilter + ") as area_mun " - + " FROM pasture_col8 a " + "INNER JOIN graphic_colors b on b.table_rel = 'pasture' " + + " FROM pasture_col9 a " + "INNER JOIN graphic_colors b on b.table_rel = 'pasture' " + " WHERE " + regionFilter // " AND " + yearFilter + + " GROUP BY 1,2,3 ORDER BY 1 ASC;", @@ -216,7 +216,7 @@ module.exports = function (app) { { source: 'lapig', id: 'estados', - sql: " SELECT UPPER(uf) AS label, '#d4a31c' as color, SUM(area_ha) as value FROM pasture_col8 " + sql: " SELECT UPPER(uf) AS label, '#d4a31c' as color, SUM(area_ha) as value FROM pasture_col9 " + "WHERE " + regionFilter + " AND " + yearFilter + " GROUP BY 1, 2 ORDER BY 3 DESC;", @@ -234,7 +234,7 @@ module.exports = function (app) { { source: 'lapig', id: 'municipios', - sql: "SELECT p.municipio as city, p.cd_geocmu as cityCode, UPPER(p.uf) as uf, SUM(p.st_area_ha) as value FROM pasture_col8 p " + sql: "SELECT p.municipio as city, p.cd_geocmu as cityCode, UPPER(p.uf) as uf, SUM(p.st_area_ha) as value FROM pasture_col9 p " + " WHERE " + regionFilter + " AND " + yearFilter + " GROUP BY 1, 2, 3 ORDER BY value DESC;", @@ -244,7 +244,7 @@ module.exports = function (app) { { source: 'lapig', id: 'estados', - sql: " SELECT UPPER(p.uf) AS uf, SUM(p.st_area_ha) as value FROM pasture_col8 p " + sql: " SELECT UPPER(p.uf) AS uf, SUM(p.st_area_ha) as value FROM pasture_col9 p " + "WHERE " + regionFilter + " AND " + yearFilter + " GROUP BY 1 ORDER BY 2 DESC;", @@ -254,7 +254,7 @@ module.exports = function (app) { { source: 'lapig', id: 'biomas', - sql: " SELECT p.bioma AS biome, SUM(p.st_area_ha) as value FROM pasture_col8 p " + sql: " SELECT p.bioma AS biome, SUM(p.st_area_ha) as value FROM pasture_col9 p " + "WHERE " + regionFilter + " AND " + yearFilter + " GROUP BY 1 ORDER BY 2 DESC;", diff --git a/src/server/database/queries/upload.js b/src/server/database/queries/upload.js index e9e9d1b..52a2b6e 100755 --- a/src/server/database/queries/upload.js +++ b/src/server/database/queries/upload.js @@ -74,7 +74,7 @@ module.exports = function (app) { const token = params['token'] const year = params['year'] const sql = "SELECT p.year as label, SUM((ST_Area(safe_intersection(st_transform(p.geom,4674), up.geom)::GEOGRAPHY) / 1000000.0)*100.0) as value " + - "FROM pasture_col8 p INNER JOIN fdw_general.upload_shapes up on ST_INTERSECTS(ST_TRANSFORM(p.geom,4674), up.geom) where p.year IS NOT NULL " + + "FROM pasture_col9 p 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}" : "") + "and up.token = ${token} GROUP BY 1 order by 1 desc"; return [ @@ -111,7 +111,7 @@ module.exports = function (app) { const token = params['token'] const year = params['year'] const sql = "SELECT p.year, SUM((ST_Area(safe_intersection(st_transform(p.geom,4674), up.geom)::GEOGRAPHY) / 1000000.0)*100.0) as area_pastagem " + - "FROM pasture_col8 p INNER JOIN fdw_general.upload_shapes up on ST_INTERSECTS(ST_TRANSFORM(p.geom,4674), up.geom) where p.year IS NOT NULL " + + "FROM pasture_col9 p 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} " : " ") + "and up.token = ${token} GROUP BY 1 order by 1 desc"; return [{ @@ -151,7 +151,7 @@ module.exports = function (app) { source: 'lapig', id: 'pastagem', sql: "SELECT p.year, SUM((ST_Area(safe_intersection(st_transform(p.geom,4674), up.geom)::GEOGRAPHY) / 1000000.0)*100.0) as area_pastagem " + - "FROM pasture_col8 p INNER JOIN fdw_general.upload_shapes up on ST_INTERSECTS(ST_TRANSFORM(p.geom,4674), up.geom) where p.year IS NOT NULL " + + "FROM pasture_col9 p 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}" : "") + "and up.token= ${token} GROUP BY 1 order by 1 desc", mantain: true @@ -164,7 +164,7 @@ module.exports = function (app) { return [{ source: 'lapig', id: 'pasture', - sql: "select distinct year from pasture_col8 pc order by year asc", + sql: "select distinct year from pasture_col9 pc order by year asc", mantain: true }, { diff --git a/src/server/descriptor/groups/pasture.json b/src/server/descriptor/groups/pasture.json index d288495..eb8e291 100755 --- a/src/server/descriptor/groups/pasture.json +++ b/src/server/descriptor/groups/pasture.json @@ -8,9 +8,9 @@ "idLayer": "pasture", "labelLayer": "translate", "visible": true, - "selectedType": "pasture_col8_s100", + "selectedType": "pasture_col9_s100", "types": [ - "pasture_col8_s100" + "pasture_col9_s100" ] }, {