Implementation of new subregions
Read the content of geopackage files
The EvaSuite allows for the calculation of different statistics in different subregions. The shape of these 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 the case of the SPICE geopackage). To get the whole list of regions stored in the geopackage file type
evasuite --showpolygons ${geopackage-file} NAME_0The output gives you exactly the regions that can be handled by the Evasuite using the geopackage file of SPICE. And exactly these 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:
extend the existing geopackage file and write to a new geopackage file
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 oldgeopackage 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 simple 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-separated 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
evasuite --addpolygonascii ${newwktfile} ${newattrib} ${oldgeopackage} ${oldattrib} ${resgeopackage}It is 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-environment
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 the
eva-suite_settings too.