Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
This is the sixth part of a blog post series on comparing spatial patterns in raster data. More information about the whole series can be found in part one.
The blog post series on comparing spatial patterns in raster data has covered a variety of methods for comparing spatial patterns in raster data, with a focus on (a) comparing two rasters at a time, and (b) using R for the analysis.
The first post listed possible motivations for such comparison, and then described the general considerations when selecting a method for comparing spatial patterns in raster data. They include if the method works for arbitrary regions (or just for overlapping regions), if the method allows the integration of the spatial context of the analysis, and the type of data the method produces (single value, multiple values, or a raster). Next, it provided an inventory of methods for comparing continuous and categorical raster data adapted from Nowosad (2024).
The next four blog posts had a more applied focus – they showed how to use R to compare spatial patterns:
- The second blog post for overlapping regions of continuous raster data.
- The third blog post for arbitrary regions on continuous raster data.
- The fourth blog post for overlapping regions on categorical raster data.
- The fifth blog post for arbitrary regions on categorical raster data.
Implementation of the methods
What is important to note is that not all methods are implemented in R, and, thus, the methods presented in the blog posts are a subset of all possible methods for comparing spatial patterns in raster data. This includes Complex Wavelet Structural Similarity Index (Sampat et al. 2009) or the Fuzzy Kappa index (Hagen‐Zanker 2009).1
Moreover, while comparing spatial patterns is a general concept, there may exist some methods developed for specific domains that are not covered in the blog posts. Please let me know if you know about such methods!
< section id="discussion" class="level2">Discussion
The introductory blog post summarized many aspects of comparing spatial patterns in raster data, including the type of the rasters (continuous or categorical), the applicability of the method for arbitrary regions, the integration of the spatial context of the analysis, and the type of the data produced by the method.
Next, the presented examples of the use of R for comparing spatial patterns in raster data highlight several additional considerations.
First, a general approach for comparing rasters is calculating the difference between them or their derivatives (e.g., a metric in a moving window). The question here is whether such a difference should be calculated just by subtracting one raster from another or by calculating the absolute difference. The former usually highlights the direction of the change, while the latter highlights the magnitude of the change regardless of the direction. An additional related question is about how to interpret the results of such a comparison- we may easily understand the increase of temperature by 5 degrees, but how can we interpret the increase of the NDVI by 0.1?
Second, some methods are sensitive to the ranges of the values in the rasters, and thus, it is essential to scale the data before the comparison. Omitting this step may lead to incorrect results, as the method may be more sensitive to the range of the values than to the spatial pattern of the data.
Third, another way to look at the comparison methods is by considering the specific questions (aspects) they answer. Some of the methods are focused on specific characteristics of spatial patterns (e.g., roughness, diversity, etc.), and some are interested in encapsulating the general properties of spatial patterns. Thus, the choice of the method should depend on the specific question we want to answer.
Fourth, the topic that was not covered in the blog posts is the preprocessing of the rasters before the comparison. This may include reclassifying the values or clipping the rasters to some extent. The preprocessing may be crucial for the comparison, as it may significantly affect the results of the analysis. These decisions should be made based on the specific question we want to answer.
< !-- new fifth -- the borders (consistency) of the patterns --> < !-- also, distance measures --> < !-- transformation of the data? -->Fifth, the blog posts showed some technical attributes of the methods and their implementations in R. They have different scalability – some may be applied to large rasters quickly, while some may be computationally expensive. Moreover, the methods require different R skill levels – some of them may be applied with just a few lines of code, while some may require more familiarity with R and numerical methods.
< section id="applications" class="level2">Applications
There are a variaty of reasons for comparing spatial patterns in raster data as listed in the first blog post (from Long and Robertson (2018)):
- To study change
- To study similarity
- To study association
- To assess spatial models
The above reasons can be expanded based on the specific question we want to answer and how many rasters we wish to compare.
In general, we may think of the comparison of spatial patterns in raster data as one-to-one, one-to-many, or many-to-many. The whole blog post series focussed on the comparison of two rasters, but many methods of the two-raster comparison can be extended to the comparison of multiple rasters (one-to-many or many-to-many).
One-to-many analysis compares the spatial pattern of one raster to the spatial pattern of multiple rasters. For example, we may take a reference raster of a given variable and compare it to multiple rasters of the same variable from different years, regions, etc. Thus, it enables us to find the raster that is most similar to the reference raster.
Many-to-many analysis focuses on the comparison of spatial patterns of multiple rasters. The most basic way of thinking about it is as a way of clustering the rasters based on their spatial patterns. Our goal may be to group areas with similar spatial patterns, and thus, to merge the areas of the most similar rasters to each other.
< section id="extensions-and-multi-dimensional-comparisons" class="level2">Extensions and multi-dimensional comparisons
Many of the presented methods can be extended to compare multi-dimensional data, for example, two raster time series. This, in general, may require one of the approaches:
- Treating each layer as a separate raster and compare corresponding layers using the methods described above (a pairwise comparison)
- Compressing the data into one dimension (e.g., one raster layer) and then comparing such compressed data
- Create temporal or spatiotemporal signatures and compare them using a dissimilarity measure
Looking ahead
This blog post series has explored various approaches to comparing spatial patterns in raster data, from foundational concepts to practical implementations in R. Whether you’re studying environmental change, validating spatial models, or analyzing land use patterns, I hope this series has provided you with practical tools and considerations for your spatial analysis work. As always, I welcome feedback and suggestions for improvements or extensions to these methods. I may also consider writing a follow-up series on the topic, so please let me know if you have any specific questions or issues you’d like to see covered in future posts.
< !-- motif and spquery mentions? --> < !-- statistical tests --> < !-- recommendations? --> < !-- future ideas: --> < !-- - ts -- spquery --> < !-- consider showing spquery (motifmw)? --> < section id="references" class="level2">References
Footnotes
I tried my best to find possible R implementations, but there is still a chance that I missed some.↩︎
Reuse
< section class="quarto-appendix-contents" id="quarto-citation">Citation
@online{nowosad2024, author = {Nowosad, Jakub}, title = {Understanding and Extending the Methods of Comparing Spatial Patterns in Raster Data}, date = {2024-11-17}, url = {https://jakubnowosad.com/posts/2024-11-17-spatcomp-bp6/}, langid = {en} }
R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.