@@ -37,12 +37,12 @@ void Connection::setDemToStorage(CellStorage& storage)
3737 SELECT\
3838 q.*\
3939 FROM\
40- (SELECT ST_Rescale(rast, 0.0005 , 0.0005 ) as rast from dem ) r,\
40+ (SELECT ST_Rescale(rast, 0.00025 , 0.00025 ) as rast from dem_s ) r,\
4141 LATERAL ST_PixelAsCentroids(ST_Clip(r.rast, {}), 1) as q\
4242 WHERE \
4343 ST_Intersects(r.rast, {})\
4444 ) as t\
45- WHERE val > 0;" , analyzedPolygon (), analyzedPolygon ());
45+ WHERE val > 0 and x < {} and y < {} ;" , analyzedPolygon (), analyzedPolygon (), getXArea (), getYArea ());
4646
4747 printf (" Query started: %d\n " , 1 );
4848 PGresult *res = this ->runQuery (formatted_dem_query.c_str ());
@@ -67,12 +67,12 @@ void Connection::setBiomassToStorage(CellStorage& storage)
6767 SELECT\
6868 q.*\
6969 FROM\
70- (SELECT ST_Rescale(rast, 0.0005, 0.00025) as rast from biomass ) r,\
70+ (SELECT ST_Rescale(rast, 0.0005, 0.00025) as rast from biomass_s ) r,\
7171 LATERAL ST_PixelAsCentroids(ST_Clip(r.rast, {}), 1) as q\
7272 WHERE \
7373 ST_Intersects(r.rast, {})\
7474 ) as t\
75- WHERE val > 80 and y < {};" , analyzedPolygon (), analyzedPolygon (), getYArea ());
75+ WHERE val > 80 and x < {} and y < {};" , analyzedPolygon (), analyzedPolygon (), getXArea (), getYArea ());
7676 PGresult *res = this ->runQuery (formatted_biomass_query.c_str ());
7777 printf (" biomass %d\t " , PQntuples (res));
7878 for (int i = 0 ; i < PQntuples (res); i++)
@@ -87,7 +87,9 @@ void Connection::setBiomassToStorage(CellStorage& storage)
8787void Connection::setFireToStorage (CellStorage& storage)
8888{
8989 const std::string formatted_fire_query = std::format (" \
90- SELECT brightness, ST_X(geom), ST_Y(geom)\
90+ SELECT brightness,\
91+ ROUND(ST_Distance(f.geom::geography, ST_SetSRID(ST_MakePoint('70', ST_Y(f.geom)), 4326)::geography)/30),\
92+ ROUND(ST_Distance(f.geom::geography, ST_SetSRID(ST_MakePoint(ST_X(f.geom),'60.5'), 4326)::geography)/30)\
9193 FROM FIRE f\
9294 WHERE ST_Intersects(f.geom, {})" , analyzedPolygon ());
9395 PGresult *res = this ->runQuery (formatted_fire_query.c_str ());
@@ -96,8 +98,8 @@ void Connection::setFireToStorage(CellStorage& storage)
9698 {
9799 double_t k = atof (PQgetvalue (res, i, 1 ));
98100 storage.setNewState (cellState::Fire,
99- (atof (PQgetvalue (res, i, 1 )) - storage. latitudeMin ) * 2 ,
100- (atof (PQgetvalue (res, i, 2 )) - storage. longtitudeMin ) * 2 );
101+ (atoi (PQgetvalue (res, i, 1 ))) ,
102+ (atoi (PQgetvalue (res, i, 2 ))) );
101103 };
102104}
103105
0 commit comments