# Finding similar local landscapes

Blog posts in the series introducing GeoPAT 2 - a software for pattern-based spatial and temporal analysis:

This is a third blog post in the series introducing GeoPAT 2 - a software for pattern-based spatial and temporal analysis. The previous two laid a foundation for pattern-based spatial analysis by explaining the three core ideas - a motifel, signature, and similarity metric. Now, I will apply these ideas to real-life problems. The first one is finding local landscapes with similar patterns.

## Introduction

Nowadays, convenient search engines (such as Google or DuckDuckGo) are essential tools in everyday life. We check the news, look for the products reviews, or find the way how to make solar eclipse glasses. Most of our searches have one thing in common though - they are based on text phrases. Additionally, some less common search methods are possible, including reverse image search.

Spatial data analysis also offers several distinct ways to search. Some only depends on values in a vector’s attribute table or raster’s values. There are also methods that search based on spatial properties of the data, for example, how an object relate in space to another one. You can look for intersections, touches, is within, etc. Finally, it is possible to search by distance.

Can you guess what are we missing in this long list? Yes, you’re (probably) right! Finding places with similar spatial patterns is not a standard spatial operation. However, it could be useful to solve many potential questions. For example, you observed some ecological process and assume that it depends on a pattern of land cover. Next, you need to find and study areas of similar land cover patterns to validate your results. Fortunately, finding similar spatial patterns is one of the GeoPAT 2 main features.

It consists of three steps:

1. Extracting local pattern features of a query (location of interest).
2. Creating a grid of motifels.
3. Comparing a query and a grid of motifels.

We will use a data from Australia as an example. You just need to download the cci_lc2015.tif land cover dataset and install GeoPAT 2 to follow the calculations below.

## Extracting local pattern features

Spatial pattern search requires just two things - a query (location of interest) and a context (the same data of a larger area). In this example, we use a 6 by 6 km site in Pilliga Forests in New South Wales, Australia as our location of interest:

This area is mostly occupied by evergreen and deciduous broad-leaved forest, but also has a few smaller patches of shrublands.

In the first step, we need to convert this map (spatial patterns of categories) into a numerical signature (read the previous blog post to learn more about signatures) using the gpat_pointshis module. It requires a number of parameters:

• -i - an input map covering the whole area that we want to be searched
• -o - a name of the output text file containing a signature of the query
• -s - a representation of the query (a type of signature)
• -x and -y - x and y coordinates of the query (alternatively, a file with coordinates can be provided with --xy_file=<file_name>)
• -z - a size of the query in pixels
gpat_pointshis -i cci_lc2015.tif -o query_signature.txt -s cooc -x 1457570 -y -3562186  -z 20


In this example, a land cover dataset with a resolution of 300 meters and covering Australia is our input map. We selected the spatial co-occurrence of categories (cooc) as a type of signature because we are interested not only in a composition of land cover classes but also in its pattern. The last parameters determine coordinates of a central point (-x 1457570 -y -3562186) and the size of a query (-z 20). In other words, the area of interest is a rectangle of 6000 by 6000 meters (20 pixels x map resolution of 300 meters) with the above coordinates in the middle.

## Creating a grid of motifels

In the second step, we create a grid of motifels - a database of patterns for the area of Australia.

Using the gpat_gridhis module, we need to provide:

• -i - an input map covering the whole area that we want to be searched
• -o - a name of the output file containing signatures of each landscape in the input map (a grid of motifels)
• -s - a representation of the query (a type of signature)
• -z and -f - a size of the landscapes from which signatures will be extracted
gpat_gridhis -i cci_lc2015.tif -o reference.grd -s cooc -z 20 -f 20


## Finding similar local landscapes

Finally, we compare pattern in our query (step 1) with every local 6 by 6 km patterns on the whole continent (step 2). Therefore, only four parameters are required by gpat_search:

• -i - a grid of motifels
• -o - a final map of similarity between -i and -r
• -r - a text file with a numerical signature of our query
• -m - a selected similarity metric
gpat_search -i reference.grd -o similarity_output -r query_signature.txt -m jsd


The output map is a raster of similarity between our query and the reference map:

Most of the reference map’s area is very different than our query (low values of similarity indicated by dark colors). However, there is also a visible number of places with a very similar local pattern. They are located in the south-west and east Australia and on Tasmania.

Finally, we can just use standard GIS methods and extract areas with the most similar land cover pattern to our query:

They do not only have the same land cover classes, but also its composition and configuration are very similar.

## What’s next

Another example of the spatial pattern search in action can be found in the GeoPAT 2 user’s manual. Now, finding similar local landscapes is easy. However, how to describe spatial pattern’s changes in time? That will be a topic for the next blog post in the GeoPAT 2 series.