Skip to content

Commit

Permalink
col8 to col9
Browse files Browse the repository at this point in the history
  • Loading branch information
jairomr authored Oct 25, 2024
1 parent 82b1a6a commit e7e5a35
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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" },
}
Expand Down
14 changes: 7 additions & 7 deletions src/server/database/queries/charts.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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;",
Expand Down Expand Up @@ -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;",
Expand All @@ -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;",
Expand All @@ -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;",
Expand All @@ -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;",
Expand Down
8 changes: 4 additions & 4 deletions src/server/database/queries/upload.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 [
Expand Down Expand Up @@ -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 [{
Expand Down Expand Up @@ -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
Expand All @@ -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
},
{
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 @@ -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"
]
},
{
Expand Down

0 comments on commit e7e5a35

Please sign in to comment.