[GRASS-user] How to get the area of a polygon in a layer

Dear all,

We are doing wildfire simulation in Grass GIS. We need to compare the area of 2 wildfire spreads after wildfire simulation ran. We tried to calculate the area of the spread using r.surf.area module. But we couldn’t identify which is the area of the simulation from areas given from that. Could anyone tell us how to get an area from spread like this?

Thank you
Best Regards
Kalindu Perera

* Kalindu Perera <kkc199408@gmail.com> [2018-10-15 13:28:15 +0530]:

Dear all,

We are doing wildfire simulation in Grass GIS. We need to compare the area
of 2 wildfire spreads after wildfire simulation ran. We tried to calculate
the area of the spread using r.surf.area module. But we couldn't identify
which is the area of the simulation from areas given from that. Could
anyone tell us how to get an area from spread like this?

Dear Kalindu,

please post exact commands you already tried.

What are the simulation output maps?
Fitst, what does `r.category` and `r.report` return when used for simulation
maps?

Then, maybe you need to "extract", each time, the "burned" area, then
use `r.surf.area` on it?

Nikos

Dear Nikos,

We have used r.ros and r.spread commands for getting the wildfire simulation.
After that, the output from the r.spread command is spread_time_observed layer(This is the output from the simulation)
We use that layer as the input layer for the r.surf.area command.

We got many area outputs from that command output and couldn’t identify what area gives the area of the “burned” area

  • I have attached the output from running r.surf.area command as an attachment.

** Another question how we can extract only the “burned” area from the spread_time_observed layer?

Thanks a lot for the quick reply
Looking forward to more knowledge

Best Regards
Kalindu Perera

On Mon, 15 Oct 2018 at 15:07, Nikos Alexandris <nik@nikosalexandris.net> wrote:

Dear all,

We are doing wildfire simulation in Grass GIS. We need to compare the area
of 2 wildfire spreads after wildfire simulation ran. We tried to calculate
the area of the spread using r.surf.area module. But we couldn’t identify
which is the area of the simulation from areas given from that. Could
anyone tell us how to get an area from spread like this?

Dear Kalindu,

please post exact commands you already tried.

What are the simulation output maps?
Fitst, what does r.category and r.report return when used for simulation
maps?

Then, maybe you need to “extract”, each time, the “burned” area, then
use r.surf.area on it?

Nikos

(attachments)

44118651_560089197782435_8564127735541137408_n.png

Please post the exact command you have used (copy-and-paste).

Then, what does

r.category spread_time_observed

and what does

r.report spread_time_observed units=c,p

return?

* Kalindu Perera <kkc199408@gmail.com> [2018-10-15 16:01:38 +0530]:

Dear Nikos,

We have used r.ros and r.spread commands for getting the wildfire
simulation.
After that, the output from the r.spread command is spread_time_observed
layer(This is the output from the simulation)
We use that layer as the input layer for the r.surf.area command.

We got many area outputs from that command output and couldn't identify
what area gives the area of the "burned" area
* I have attached the output from running r.surf.area command as an
attachment.

** Another question how we can extract only the "burned" area from the
spread_time_observed layer?

Thanks a lot for the quick reply
Looking forward to more knowledge

Best Regards
Kalindu Perera

On Mon, 15 Oct 2018 at 15:07, Nikos Alexandris <nik@nikosalexandris.net>
wrote:

* Kalindu Perera <kkc199408@gmail.com> [2018-10-15 13:28:15 +0530]:

>Dear all,
>
>We are doing wildfire simulation in Grass GIS. We need to compare the area
>of 2 wildfire spreads after wildfire simulation ran. We tried to calculate
>the area of the spread using r.surf.area module. But we couldn't identify
>which is the area of the simulation from areas given from that. Could
>anyone tell us how to get an area from spread like this?

Dear Kalindu,

please post exact commands you already tried.

What are the simulation output maps?
Fitst, what does `r.category` and `r.report` return when used for
simulation
maps?

Then, maybe you need to "extract", each time, the "burned" area, then
use `r.surf.area` on it?

Nikos

--
Nikos Alexandris | Remote Sensing & Geomatics
GPG Key Fingerprint 6F9D4506F3CA28380974D31A9053534B693C4FB3

Hi Nikos,

Commands are as follows

r.ros,
r.ros --overwrite model=fuel_model@demomapset moisture_1h=1hour_moisture@demomapset moisture_live=live_moisture@demomapset velocity=wind_speed@demomapset direction=wind_direction@demomapset slope=slope@demomapset aspect=aspect@demomapset elevation=elevation@demomapset base_ros=my_ros.base max_ros=my_ros.max direction_ros=my_ros.maxdir spotting_distance=my_ros.spotdist

r.spread,
r.spread --overwrite base_ros=my_ros.base@demomapset max_ros=my_ros.max@demomapset direction_ros=my_ros.maxdir@demomapset start=fire_origin@demomapset wind_speed=wind_speed@demomapset output=spread_time_observed

After entering; r.category spread_time_observed,

1.png

After entering; r.report spread_time_observed units=c,p,

Screenshot from 2018-10-15 21-40-46.png

Thank You
Best Regards
Kalindu Perera

On Mon, 15 Oct 2018 at 20:30, Nikos Alexandris <nik@nikosalexandris.net> wrote:

Please post the exact command you have used (copy-and-paste).

Then, what does

r.category spread_time_observed

and what does

r.report spread_time_observed units=c,p

return?

Dear Nikos,

We have used r.ros and r.spread commands for getting the wildfire
simulation.
After that, the output from the r.spread command is spread_time_observed
layer(This is the output from the simulation)
We use that layer as the input layer for the r.surf.area command.

We got many area outputs from that command output and couldn’t identify
what area gives the area of the “burned” area

  • I have attached the output from running r.surf.area command as an
    attachment.

** Another question how we can extract only the “burned” area from the
spread_time_observed layer?

Thanks a lot for the quick reply
Looking forward to more knowledge

Best Regards
Kalindu Perera

On Mon, 15 Oct 2018 at 15:07, Nikos Alexandris <nik@nikosalexandris.net>
wrote:

Dear all,

We are doing wildfire simulation in Grass GIS. We need to compare the area
of 2 wildfire spreads after wildfire simulation ran. We tried to calculate
the area of the spread using r.surf.area module. But we couldn’t identify
which is the area of the simulation from areas given from that. Could
anyone tell us how to get an area from spread like this?

Dear Kalindu,

please post exact commands you already tried.

What are the simulation output maps?
Fitst, what does r.category and r.report return when used for
simulation
maps?

Then, maybe you need to “extract”, each time, the “burned” area, then
use r.surf.area on it?

Nikos


Nikos Alexandris | Remote Sensing & Geomatics
GPG Key Fingerprint 6F9D4506F3CA28380974D31A9053534B693C4FB3

Kalindu Perera:

Commands are as follows

*r.ros,*
r.ros --overwrite model=fuel_model@demomapset
moisture_1h=1hour_moisture@demomapset moisture_live=live_moisture@demomapset
velocity=wind_speed@demomapset direction=wind_direction@demomapset
slope=slope@demomapset aspect=aspect@demomapset
elevation=elevation@demomapset base_ros=my_ros.base max_ros=my_ros.max
direction_ros=my_ros.maxdir spotting_distance=my_ros.spotdist

*r.spread,*
r.spread --overwrite base_ros=my_ros.base@demomapset
max_ros=my_ros.max@demomapset direction_ros=my_ros.maxdir@demomapset
start=fire_origin@demomapset wind_speed=wind_speed@demomapset
output=spread_time_observed

*After entering; r.category spread_time_observed,*
[image: 1.png]

*After entering; r.report spread_time_observed units=c,p,*
[image: Screenshot from 2018-10-15 21-40-46.png]

Dear Kalindu,

thank you for the above.

If all is right, you might just need to properly prepare the input data
and/or the output of `r.ros`, for example, to label raster categories
appropriately. Then, modules like `r.report` will show also the label
for each raster category.

When drawing the `spread_time_observed` map, can you identify visually the
raster category of your interest? If yes, pick up the the "Query
raster/vector map(s)" tool (4th button in wxGUI's Map Display window),
and select any pixel of the category of your interest. This will tell
the value (of the pixel you selected) and a label (if any is given).

Knowing this value, you can extract all pixels of this value using
`r.mapcalc`. For example, say the raster category (or value) of
interest, is 3. Then, something like

r.mapcalc "category_3 = if(spread_time_observed == 3, 3, null())"

will create a map with all pixels of value 3.

I guess using this "category_3" map as an input to `r.surf.area` would
give the area estimation you require. Please, take care to read the
NOTES in `r.surf`area`'s manual about "edge effects" though.

Else, I think the easiest/fastest for me would to be to have access to sample
data (even via a private message). If possible, cutting out (setting via
`g.region`) a small fragment from your study area, and sharing would
allow me to "resolve" this.

Also, please don't post screenshots (if it is not about part of maps or other
visuals). For textual output, please always post the output of your commands
(as in copy and paste) or attach a text file.

For example, I would copy-and-paste the complete output of (or put in a
text file if a specific output of a command is really too long):

# in Bash
for MAP in fuel_model 1hour_moisture live_moisture wind_speed wind_direction slope aspect elevation my_ros.base my_ros.max my_ros.maxdir my_ros.spotdist fire_origin spread_time_observed ;do r.category $MAP ;done

# in Windows
see example in: https://lists.osgeo.org/pipermail/grass-user/2018-June/078526.html

Nikos

Thanks a lot…!!!..Nikos
We will look into it
If we couldn’t do it we will definitely ask your help

Thanks again for the help.

Best Regards
Kalindu Perera

On Tue, 16 Oct 2018 at 09:39, Nikos Alexandris <nik@nikosalexandris.net> wrote:

Kalindu Perera:

Commands are as follows

r.ros,
r.ros --overwrite model=fuel_model@demomapset
moisture_1h=1hour_moisture@demomapset moisture_live=live_moisture@demomapset
velocity=wind_speed@demomapset direction=wind_direction@demomapset
slope=slope@demomapset aspect=aspect@demomapset
elevation=elevation@demomapset base_ros=my_ros.base max_ros=my_ros.max
direction_ros=my_ros.maxdir spotting_distance=my_ros.spotdist

r.spread,
r.spread --overwrite base_ros=my_ros.base@demomapset
max_ros=my_ros.max@demomapset direction_ros=my_ros.maxdir@demomapset
start=fire_origin@demomapset wind_speed=wind_speed@demomapset
output=spread_time_observed

After entering; r.category spread_time_observed,
[image: 1.png]

After entering; r.report spread_time_observed units=c,p,
[image: Screenshot from 2018-10-15 21-40-46.png]

Dear Kalindu,

thank you for the above.

If all is right, you might just need to properly prepare the input data
and/or the output of r.ros, for example, to label raster categories
appropriately. Then, modules like r.report will show also the label
for each raster category.

When drawing the spread_time_observed map, can you identify visually the
raster category of your interest? If yes, pick up the the “Query
raster/vector map(s)” tool (4th button in wxGUI’s Map Display window),
and select any pixel of the category of your interest. This will tell
the value (of the pixel you selected) and a label (if any is given).

Knowing this value, you can extract all pixels of this value using
r.mapcalc. For example, say the raster category (or value) of
interest, is 3. Then, something like

r.mapcalc "category_3 = if(spread_time_observed == 3, 3, null())"

will create a map with all pixels of value 3.

I guess using this “category_3” map as an input to r.surf.area would
give the area estimation you require. Please, take care to read the
NOTES in r.surfarea`'s manual about “edge effects” though.

Else, I think the easiest/fastest for me would to be to have access to sample
data (even via a private message). If possible, cutting out (setting via
g.region) a small fragment from your study area, and sharing would
allow me to “resolve” this.

Also, please don’t post screenshots (if it is not about part of maps or other
visuals). For textual output, please always post the output of your commands
(as in copy and paste) or attach a text file.

For example, I would copy-and-paste the complete output of (or put in a
text file if a specific output of a command is really too long):

in Bash

for MAP in fuel_model 1hour_moisture live_moisture wind_speed wind_direction slope aspect elevation my_ros.base my_ros.max my_ros.maxdir my_ros.spotdist fire_origin spread_time_observed ;do r.category $MAP ;done

in Windows

see example in: https://lists.osgeo.org/pipermail/grass-user/2018-June/078526.html

Nikos