FOI Assessment¶
FOI Assessment: Heterogeneity and Cardinality
The FOI assessment notebook is based on the principle that inside of a homogenous FOI there should be only one type of pixels. In the same idea, a FOI which respects the 1-1 cardinalityshould not include clusters of pixels larger than a specified threshold (we can consider dispersed pixels different than the main class as “noise”). The FOI Assessment performs a spatial analysis on a “thematic raster” produced in advance. The thematic raster can be the result of any image/raster processing method yielding a class label for each pixel - crop classification, behavior analysis of land phenomenon, gridded data on soil, slope, humidity, etc. As an example, if the thematic raster is the result of a crop classification, a homogeneous FOI should have only one type of pixels that represent the respective crop, a cardinal FOI should not include any cluster of pixels from other class larger than a specified threshold. If the thematic raster is the result of a behavior analysis, all the pixels inside an FOI should behave in the same way during a period of time. For both heterogeneity and cardinality, the notebook provides two methods for the analysis: one based area calculation (version 1) and one based on cluster size calculation (version 2). Both methods have similar results. Version 1 The first version requires the connection to a database server (PostgreSQL with PostGIS extension) For the heterogeneity analysis the following steps are required (the steps correspond to the numbering on the interface):
Connect to the database (at the moment only „Database connection settings” are required) a) Upload the reference data shapefile to the server. It is provided a graphical interface for upload. b) Import uploaded shapefile to the database, specifying the name for the table that will be created in the database.
Upload the raster „thematic” image. A graphical interface is provided. The accepted files are tif or tiff files. The thematic raster should be a one band raster file, with the pixel values representing the classes (like crop type or type of behaviour)
#. Prepare FOI procedure – Allows the user to create the database functions on the database server. This procedure creates the necessary function and stored procedures on the database server. #.
- Select the required files for analysis:
Vector file: the data on which the analysis will be applied. In case that we have more shapefiles uploaded on the server, this functionality allows us to select the one that we want to analyze.
Thematic raster: the thematic raster provided. In case that we have more rasters uploaded on the server, this functionality allows us to select the one that we want to use on the analysis.
YAML file that holds the classes form the thematic raster file: this file specifies the classes of pixels from the thematic raster and can also provide the meaning of those classes. It should have the following structure: example.yml
category_map: 0: Unclasified 1: Class1 2: Class2 3: Class3 4: Class4 5: Class5 6: Class6 7: Class7 8: Class8 9: Class9 10: Class10 Class1, Class2 can be replaced by the meaning of the class (like Wheat, Maize, etc. or by behavior name or any other ….). The YAML file should include all the classes that exist in the thematic raster. It is provided a graphical interface for upload.
Analysis parameters: Heterogeneity thresholds: in order to exclude the influence of „noise” pixels, the user can specify the heterogeneity thresholds (for example only the FOIs where one class of pixels have a percentage between 30 and 70 is considered heterogeneous). Minimum area for clusters selection: the user can specify the minimum area of the cluster that are considered a cardinality issue, in square meters. Of example the clusters smaller than 2000 square meters can be considered as not influencing the FOI cardinality.
Run FOI procedure.
Starts the FOI analysis. The result of the analysis is represented by three shapefiles that are stored on the “output_data” folder (/cbm/tmp/foi/output_data). name of the shapefile dataset (without extension) that needs to be tested + foih_v1.shp – represents the initial shapefile and during the analysis the following attributes are added:
foi_h – heterogeneity flag (0 for homogeneous FOIs and 1 for heterogeneous FOIs)
number of pixels for each class (the name of the attribute is the name of the class)
total number of pixel for the respective FOI
percentage of pixels from each class (number of pixels for each class / total number of pixels inside the FOI) name of the shapefile dataset (without extension) that needs to be tested + foic_v1.shp - represents the initial shapefile and during the analysis the following attributes are added:
foi_c – cardinality flag (0 for FOIs respecting the 1-1 cardinality and 1 for FOIs not respecting the 1-1 cardinality). As a result of this analysis, the FOIs that include more than one cluster of pixel from different classes bigger than the threshold are considered non-cardinal. For example and FOI that includes two clusters of pixels from different classes (one arable land and non-agricultural area), each of the clusters bigger than the threshold (ex. 2000 square meters), is considered as not respecting the 1-1 cardinality. name of the shapefile dataset (without extension) that needs to be tested + foic_clusters_v1.shp – represents only the clusters of pixels that are setting the FOI cardinality (for example if an FOI includes three clusters of pixels bigger that the threshold, only those clusters will be saved in this shapefile)