lucCalculus
lucCalculus copied to clipboard
Spatiotemporal calculus for land use change trajectories
Land Use Change Calculus (lucCalculus)
This package implements the LUC Calculus for reasoning about land use change trajectories. Based on a set of classified time series, we build expressions to answer specific questions, such as Which events of "Forest" areas were replaced by "Pasture"?
With package "lucCalculus" is possible to build questions using Allen's interval temporal logic relationships and also others extended from their study. I suggest the reader read (Allen 1983) and (Allen 1984) for more details. Besides, is possible to generate graphics with event information and plot maps with results. Using these events the user can to perform analysis on time series data to discover important land use changes.
Prerequisites:
- Git
- R
- Rstudio
- A set of classified GeoTIFF images by year
- The lucCalculus requires "devtools" package is available.
How to use the package:
- Open RStudio
- Install devtools
install.packages("devtools")
- Load devtools
library(devtools)
- Install the lucCalculus package
install_github("e-sensing/lucCalculus")
Example 1
-
This example was perfomed in Itanhanga municipality, in Mato Grosso state, Brazil.
-
Load the lucCalculus package
library(lucCalculus)
-
Create a RasterBrick from a set of classified images
library(lucCalculus) options(digits = 12) #----------------------- # 0. Open images and create a RasterBrick #----------------------- # create a RasterBrick from individual raster GeoTIFF classified previously lucC_create_RasterBrick(path_open_GeoTIFFs = c(system.file("extdata/raster/rasterItanhanga", package = "lucCalculus")), path_save_RasterBrick = getwd()) # ------------- define variables to use in metadata ------------- # open files file
- Plotted RasterBrick rb_class
![]() Fig. 1. Plot images classified from a RasterBrick |
- Apply lucC_pred_holds function to discover events of Degradation and Pasture in different time intervals. Parameter relation_interval = "equals" or "contains" produce different results to HOLDS. "Equals" says that all states/events must holds for each subinterval of time interval, whereas "Contains" says that one state/event can appear only once in entire time interval.
# Forest holds from 2001 to 2007 a
![]() Fig. 2.(a) Locations over time |
![]() Fig. 2.(b) Barplot with number of states in km² |
- Plotted RasterBrick rb_class results
![]() Fig. 3. Plot images classified from a RasterBrick and states from Before relation |
Example 2
- Apply LUC Calculus to discover secondary vegetation from RasterBrick. We are insterested only in Forest class that RECUR after a non-sequential interval and Forest that EVOLVE after a different class in 2001. After this we update the original raster.
#---------------------------- # 1. RECUR predicate indicates a class that appear again #---------------------------- forest_recur
- Plotted RasterBrick rb_class results
![]() Fig. 4. Plot images classified from a RasterBrick and states from RECUR relation |
#---------------------------- # 2. EVOLVE to verify Forest class that occurs after a different class in 2001 #---------------------------- forest_evolve
- Plotted RasterBrick rb_class results
![]() Fig. 5. Plot images classified from a RasterBrick and states from EVOLVE relation |
#---------------------------- # 3. Merge both forest_recur and forest_evolve data sets #---------------------------- forest_secondary
- Plotted RasterBrick rb_class results of secondary vegetation
![]() Fig. 6. Plot images classified from a RasterBrick and states from EVOLVE and RECUR relations, and also secondary vegetation locations |
Example 3
- Update a raster with new value of pixel and open rasterBrick with new label.
#---------------------------- # 4. Update original raster to add new pixel value #---------------------------- n_label
- Plotted RasterBrick rb_class results with new class Secondary Vegetation
![]() Fig. 7. Plot a RasterBrick and states with new secondary vegetation class |
Example 4
- Difference between Forest and Secondary Vegetatation
#---------------------------- # 5. Discover Forest and Secondary vegetation - LUC Calculus #---------------------------- secondary.mtx
- Quantity of Forest and Secondary vegetation after LUC Calculus application
![]() Fig. 8. Number of Forest and Secondary Vegetation |
Example 5
- Difference between Forest and Secondary Vegetatation
#---------------------------- # 5. Discover direct land use transitions #---------------------------- class1
- Direct land use transition from Forest class to others in Itanhangá municipality
![]() Fig. 9. Quantity of direct land use transitions |