Implementation of new subregions

Read the content of geopackage files

The Evasuite allows for calculation of different statistics in different subregions. The shape of this subregions is treated by the Evasuite using so-called geopackage files which is an extension of the former known shape files. If you want to perform the evaluation in SPICE, you need to specify a geopackage file and the name of the attribute (column of attribute table), which contains the names of the shapes used for evaluation. Both settings are already pre-specified during the SPICE installation and can be found in the general configuration template of the Evasuite: ${SPDIR}/src/eva-suite/config_SUITEgeneral_TEMPLATE.yaml . See there the option polyfile , which is defined in eva-suite_settings, and the option attribregion, which is fixed to NAME_0.

It makes sense to start with the inspection of the geopackage file shipped with the installation of SPICE. It should be located in ${SPDIR/src/eva-suite/geodata/EvaSuite_PRUDENCE.gpkg. Type the following

evasuite --showpolygons ${geopackage-file}

to receive a list of the content. Please investigate the header of the table shown and identify the attribute name for the region names (which is 'NAME_0' in case of the SPICE geopackage). To get the whole list of regions stored in the geopackage file type

evasuite --showpolygons ${geopackage-file} NAME_0

The output gives you exactly the regions which can be handled by the Evasuite using the geopackage file of SPICE. And exactly this subregions can be used to specify the option SUBREGIONS in the eva-suite_settings.

If you want to handle more regions, you need to do two steps:

  1. extend the existing geopackage file and write to a new geopackage file

  2. specify the new geopackage file in the SPICE-environment.

Step 1: Extend geopackage file by user-specified subregions

There are two possibilities to extend the geopackage file delivered with SPICE.

A) Add subregions using another geopackage file

This can be done using the following syntax

evasuite --addpolygondb ${newgeopackage} ${newattrib} ${newregionnames} ${oldgeopackage} ${oldattrib} ${resgeopackage}

The old geopackage file oldgepackage with regions stored under the attribute oldattrib is extended by the content of the new geopackage file newgeopackage. With respect to the content of the new geopackage file, one has to specify the attribute newattrib and the values of the attribute newregionnames, which are simply the names of the regions stored in the new geopackage file. You can specify a single string or a list of strings separated by a comma. The final file is stored in result and the final attribute is the same as oldattrib.

After successful execution of the command above, you get a list of all polygons stored in the resgeopackage file.

B) Add subregions using a simple ascii file

One can also extend the already existing geopackage file by polygons stored in the so-called wkt-format. This format is recommended if only rectangular polygons or other simply polygons have to be implemented. The wkt format reads like this:

ID;NAME_0;geometry
1;Isreal;POLYGON ((27.0 28.5, 40.5 28.5, 40.5 35.7, 27.0 35.7, 27.0 28.5))
2;Spitzbergen;POLYGON ((10.5 76.0, 30.0 76.0, 30.0 81.0, 10.5 81.0, 10.5 76.0 ))

It is mandatory to specify an ID, a name for the region and the geometry, which is a comma-seperated list of coordinates of points. The coordinates are given as longitude and latitude in the WGS84 system. The command POLYGON(( indicates the beginning of a polygon definition, which has to be finalized with )).

So, you can extend the standard geopackage file by the polygons defined in a user-specified wkt-file using the following syntax

It is the nearly the same procedure as for case A), but the final file is extended by ALL regions stored in newwktfile under the attribute newattrib.

After successful execution of the command above, you get a list of all polygons stored in the resgeopackage file.

Step 2: Define a new geopackage file for SPICE-enviroment

The names of new shapes stored in the new geopackage file (see Step 1) can be used as subregions in the eva-suite_settings. Moreover, the new geopackage file has to be defined in eva-suite_settings too.