Analyzing forest fires with the geoideo package
Antony Barja
26 September, 2024
Source:vignettes/article.Rmd
article.Rmd
1. Introduction
geoidep
currently allows you to work with data from
Serfor’s Satellite Tracking Unit.
However, this project is still under construction, for more information you can visit the GitHub official repository https://github.com/ambarja/geoidep.
If you want to support this project, you can support me with a coffee for my programming moments.
2. Package installation
install.packages("geoidep")
Also, you can install the development version as follows:
install.packages('pak')
pak::pkg_install('ambarja/geoidep')
3. Filter the available Serfor layer
providers <- get_data_sources(query = "Serfor")
providers
#> # A tibble: 2 × 7
#> provider category layer layer_can_be_actived admin_en year link
#> <chr> <chr> <chr> <lgl> <chr> <chr> <chr>
#> 1 Serfor Hazard fire_forest TRUE Ministry of En… Not … http…
#> 2 Serfor Hazard hot_spots TRUE Ministry of En… Not … http…
4. Forest fire data collection download
incendio.forestal <- get_forest_fire_data(show_progress = FALSE)
#> Reading layer `file1c653422eace' from data source
#> `/tmp/RtmpcZl51R/file1c653422eace.geojson' using driver `GeoJSON'
#> Simple feature collection with 3455 features and 34 fields
#> Geometry type: POINT
#> Dimension: XY
#> Bounding box: xmin: -79.13259 ymin: -14.43376 xmax: -68.98307 ymax: -3.47667
#> Geodetic CRS: WGS 84
head(incendio.forestal)
#> Simple feature collection with 6 features and 34 fields
#> Geometry type: POINT
#> Dimension: XY
#> Bounding box: xmin: -77.68121 ymin: -8.50344 xmax: -74.50126 ymax: -7.80636
#> Geodetic CRS: WGS 84
#> OBJECTID FUENTE DOCREG FECREG
#> 1 208276 Servicio Nacional Forestal y de Fauna Silvestre 2024-09-25
#> 2 208927 Servicio Nacional Forestal y de Fauna Silvestre 2024-09-25
#> 3 209268 Servicio Nacional Forestal y de Fauna Silvestre 2024-09-25
#> 4 209269 Servicio Nacional Forestal y de Fauna Silvestre 2024-09-25
#> 5 209270 Servicio Nacional Forestal y de Fauna Silvestre 2024-09-25
#> 6 209271 Servicio Nacional Forestal y de Fauna Silvestre 2024-09-25
#> OBSERV
#> 1 Información generada por la Unidad Funcional de Monitoreo Satelital de la DGIOFFS de SERFOR
#> 2 Información generada por la Unidad Funcional de Monitoreo Satelital de la DGIOFFS de SERFOR
#> 3 Información generada por la Unidad Funcional de Monitoreo Satelital de la DGIOFFS de SERFOR
#> 4 Información generada por la Unidad Funcional de Monitoreo Satelital de la DGIOFFS de SERFOR
#> 5 Información generada por la Unidad Funcional de Monitoreo Satelital de la DGIOFFS de SERFOR
#> 6 Información generada por la Unidad Funcional de Monitoreo Satelital de la DGIOFFS de SERFOR
#> ZONUTM ORIGEN NOMDEP NOMPRO NOMDIS CAPITAL FECHA
#> 1 18 2 UCAYALI CORONEL PORTILLO MANANTAY SAN FERNANDO 2024-09-25
#> 2 18 2 LORETO UCAYALI CONTAMANA CONTAMANA 2024-09-25
#> 3 18 2 ANCASH SIHUAS CHINGALPO CHINGALPO 2024-09-25
#> 4 18 2 ANCASH SIHUAS CHINGALPO CHINGALPO 2024-09-25
#> 5 18 2 UCAYALI PADRE ABAD CURIMANA CURIMANA 2024-09-25
#> 6 18 2 UCAYALI PADRE ABAD CURIMANA CURIMANA 2024-09-25
#> HORA CATEG NOMCATEG LATITUD LONGITUD COORES COORNO
#> 1 13:41:00 30 -8.50344 -74.50126 554891.9 9060010
#> 2 16:00:00 24 SAN LUIS DE CHARASMANA -7.80636 -75.35967 460346.0 9137092
#> 3 12:54:00 30 -8.33020 -77.68121 204671.5 9078196
#> 4 12:54:00 30 -8.32955 -77.67597 205248.6 9078272
#> 5 13:41:00 30 -8.33308 -75.08912 490187.2 9078878
#> 6 12:54:00 30 -8.32980 -75.08677 490445.9 9079241
#> CODREP created_user created_date last_edited_user
#> 1 PIF_02508_2024 JMONTALBAN 2024-09-26 00:28:09 JMONTALBAN
#> 2 PIF_04178_2024 JMONTALBAN 2024-09-26 00:28:09 JMONTALBAN
#> 3 PIF_04246_2024 JMONTALBAN 2024-09-26 00:28:09 JMONTALBAN
#> 4 PIF_04246_2024 JMONTALBAN 2024-09-26 00:28:09 JMONTALBAN
#> 5 PIF_04247_2024 JMONTALBAN 2024-09-26 00:28:09 JMONTALBAN
#> 6 PIF_04247_2024 JMONTALBAN 2024-09-26 00:28:09 JMONTALBAN
#> last_edited_date ESTADO TIPCOB PELIGRO REFESTADO CONF CODRVIF
#> 1 2024-09-26 00:28:09 1 Cobertura Forestal 0 0 0 0
#> 2 2024-09-26 00:28:09 1 Cobertura Forestal 0 0 0 0
#> 3 2024-09-26 00:28:09 1 Cobertura Forestal 0 0 0 0
#> 4 2024-09-26 00:28:09 1 Cobertura Forestal 0 0 0 0
#> 5 2024-09-26 00:28:09 1 Cobertura Forestal 0 0 0 0
#> 6 2024-09-26 00:28:09 1 Cobertura Forestal 0 0 0 0
#> SENSAT CATDEP CATPRO CATDIS geometry
#> 1 N20 25 2501 250107 POINT (-74.50126 -8.50344)
#> 2 GOES (16 y 17) 16 1606 160601 POINT (-75.35967 -7.80636)
#> 3 N21 02 0219 021905 POINT (-77.68121 -8.3302)
#> 4 N21 02 0219 021905 POINT (-77.67597 -8.32955)
#> 5 N20 25 2503 250303 POINT (-75.08912 -8.33308)
#> 6 N21 25 2503 250303 POINT (-75.08677 -8.3298)
5. National Forest Fire Count
library(sf)
library(dplyr)
library(ggplot2)
stats <- incendio.forestal |>
st_drop_geometry() |>
filter(FECHA >= '2024-09-11') |>
group_by(NOMDEP) |>
summarise( total = n())
# Simple visualisation
stats |>
ggplot(aes(x = NOMDEP, y = total)) +
geom_bar(stat = "identity") +
coord_polar() +
theme_minimal(base_size = 10) +
labs(x="", y = "", caption = "Unidad de Monitoreo Forestales - SERFOR")
6. Download the official INEI administrative limits of interest
# Region boundaries download
ucayali_dep <- get_departaments(show_progress = FALSE) |>
subset(NOMBDEP == 'UCAYALI')
# The first five rows
head(ucayali_dep)
#> Simple feature collection with 1 feature and 6 fields
#> Geometry type: MULTIPOLYGON
#> Dimension: XY
#> Bounding box: xmin: -75.94789 ymin: -11.44834 xmax: -70.49442 ymax: -7.262049
#> Geodetic CRS: WGS 84
#> id OBJECTID CCDD NOMBDEP SHAPE_Length SHAPE_Area
#> 24 24 24 25 UCAYALI 27.47016 8.660111
#> geom
#> 24 MULTIPOLYGON (((-74.47145 -...
7. Forest fire count in the area of interest only
# Data collection only within the regions of interest.
ucayali.if <- st_filter(incendio.forestal, ucayali_dep)
head(ucayali.if)
#> Simple feature collection with 6 features and 34 fields
#> Geometry type: POINT
#> Dimension: XY
#> Bounding box: xmin: -75.17516 ymin: -8.507046 xmax: -74.49729 ymax: -8.3022
#> Geodetic CRS: WGS 84
#> OBJECTID FUENTE DOCREG FECREG
#> 1 208276 Servicio Nacional Forestal y de Fauna Silvestre 2024-09-25
#> 2 209270 Servicio Nacional Forestal y de Fauna Silvestre 2024-09-25
#> 3 209271 Servicio Nacional Forestal y de Fauna Silvestre 2024-09-25
#> 4 208034 Servicio Nacional Forestal y de Fauna Silvestre 2024-09-25
#> 5 209272 Servicio Nacional Forestal y de Fauna Silvestre 2024-09-25
#> 6 208277 Servicio Nacional Forestal y de Fauna Silvestre 2024-09-25
#> OBSERV
#> 1 Información generada por la Unidad Funcional de Monitoreo Satelital de la DGIOFFS de SERFOR
#> 2 Información generada por la Unidad Funcional de Monitoreo Satelital de la DGIOFFS de SERFOR
#> 3 Información generada por la Unidad Funcional de Monitoreo Satelital de la DGIOFFS de SERFOR
#> 4 Información generada por la Unidad Funcional de Monitoreo Satelital de la DGIOFFS de SERFOR
#> 5 Información generada por la Unidad Funcional de Monitoreo Satelital de la DGIOFFS de SERFOR
#> 6 Información generada por la Unidad Funcional de Monitoreo Satelital de la DGIOFFS de SERFOR
#> ZONUTM ORIGEN NOMDEP NOMPRO NOMDIS CAPITAL FECHA
#> 1 18 2 UCAYALI CORONEL PORTILLO MANANTAY SAN FERNANDO 2024-09-25
#> 2 18 2 UCAYALI PADRE ABAD CURIMANA CURIMANA 2024-09-25
#> 3 18 2 UCAYALI PADRE ABAD CURIMANA CURIMANA 2024-09-25
#> 4 18 2 UCAYALI PADRE ABAD CURIMANA CURIMANA 2024-09-24
#> 5 18 2 UCAYALI PADRE ABAD CURIMANA CURIMANA 2024-09-25
#> 6 18 2 UCAYALI CORONEL PORTILLO MANANTAY PUCALLPA 2024-09-25
#> HORA CATEG NOMCATEG LATITUD LONGITUD COORES COORNO
#> 1 13:41:00 30 -8.50344 -74.50126 554891.9 9060010
#> 2 13:41:00 30 -8.33308 -75.08912 490187.2 9078878
#> 3 12:54:00 30 -8.32980 -75.08677 490445.9 9079241
#> 4 13:13:00 14 Forest Product Florida SAC -8.30220 -75.17516 480712.0 9082289
#> 5 12:54:00 30 -8.32936 -75.08341 490815.8 9079290
#> 6 11:20:00 30 -8.50705 -74.49729 555328.7 9059611
#> CODREP created_user created_date last_edited_user
#> 1 PIF_02508_2024 JMONTALBAN 2024-09-26 00:28:09 JMONTALBAN
#> 2 PIF_04247_2024 JMONTALBAN 2024-09-26 00:28:09 JMONTALBAN
#> 3 PIF_04247_2024 JMONTALBAN 2024-09-26 00:28:09 JMONTALBAN
#> 4 PIF_04165_2024 JMONTALBAN 2024-09-25 13:53:48 JMONTALBAN
#> 5 PIF_04247_2024 JMONTALBAN 2024-09-26 00:28:09 JMONTALBAN
#> 6 PIF_02508_2024 JMONTALBAN 2024-09-26 00:28:09 JMONTALBAN
#> last_edited_date ESTADO TIPCOB PELIGRO REFESTADO CONF CODRVIF
#> 1 2024-09-26 00:28:09 1 Cobertura Forestal 0 0 0 0
#> 2 2024-09-26 00:28:09 1 Cobertura Forestal 0 0 0 0
#> 3 2024-09-26 00:28:09 1 Cobertura Forestal 0 0 0 0
#> 4 2024-09-25 13:53:48 1 Cobertura Forestal 0 0 0 0
#> 5 2024-09-26 00:28:09 1 Cobertura Forestal 0 0 0 0
#> 6 2024-09-26 00:28:09 1 Cobertura Forestal 0 0 0 0
#> SENSAT CATDEP CATPRO CATDIS geometry
#> 1 N20 25 2501 250107 POINT (-74.50126 -8.50344)
#> 2 N20 25 2503 250303 POINT (-75.08912 -8.33308)
#> 3 N21 25 2503 250303 POINT (-75.08677 -8.3298)
#> 4 N21 25 2503 250303 POINT (-75.17516 -8.3022)
#> 5 N21 25 2503 250303 POINT (-75.08341 -8.32936)
#> 6 GOES (16 y 17) 25 2501 250107 POINT (-74.49729 -8.507046)
8. Simple visualization with leaflet
library(leaflet)
#>
#> Attaching package: 'leaflet'
#> The following object is masked _by_ '.GlobalEnv':
#>
#> providers
library(leaflet.extras)
ucayali.if |>
leaflet() |>
addProviderTiles(provider = "CartoDB.Positron") |>
addHeatmap(radius = 10,minOpacity = 1)