How to create efficient territory dictionary
Prognoz Platform maps offers many interesting and useful functions. However, to enjoy all of them you’ll need to configure the territory dictionary. Today I will explain how to do it.
As you already know, the Prognoz Platform provides a variety of map capabilities. To use all of them, you need to pave the way for future work. That is, to configure your territory dictionary as appropriate. This article covers dictionary’s features required to:
- bind dictionary elements to map elements
- automatically select the map
- keep map versioning
How to bind a map to dictionaries
Map binding is the simplest but the most important setting among the map configurations. Without binding, your map will display no data. Suppose we have a territory dictionary and a map loaded to the Platform. To associate a relevant dictionary element (e.g., Perm Territory) with the specific map territory, the Platform needs a binding attribute.
The binding attribute shall have the TERRID identifier. Any dictionary having this attribute becomes a territory dictionary. If your cube has no territory dictionary, the Map visualizer will be unavailable. Codes of the territory dictionary must correspond to codes written in the ISO attribute of the map’s topographic basis. By the way, the map area can be displayed both as a polygon and a territory contour (see figure below). Let’s go on.
How to set up the automatic map selection
The Prognoz Platform’s repository enables you to set up the map by default. That is, the same map will be used by default for all the sources where the user does not configure territory dictionaries. This default setting is convenient if you analyze data by territories of a single country. However, if you switch between different territories, such as Asian countries and US states, you need a mechanism for the automatic map selection.
The mechanism provides the automatic selection of a map depending on elements selected in the territory dictionary. For example, if you select Russia, the United States, and the Republic of South Africa, the optimal choice will be the map of the world. If you select territories of a single country, the Platform will show a corresponding country map by regions. It makes perfect sense as looking for a country region on the map of the world is not very convenient.
Of course, you can customize the map selection as per your needs. To customize the map, create attributes TOPO_ID, TOPO_ID2, TOPO_ID3 … TOPO_IDN in the territory dictionary. The number of attributes depends on the number of levels in the map hierarchy.
Let’s consider an example: We have a dictionary with four hierarchical levels, including (1) World, (2) Continents, (3) Countries, and (4) Regions.
The first level consists of a single World element.
- If we select only this element in the territory dimension of the report, the map will be built using the Map object of the repository with the key that is written in the TOPO_ID attribute for the World element
- If we select the World and Asia, the key will be taken from TOPO_ID2
- If we select the World, Asia, and Russia, the key will be taken from TOPO_ID3
- As you probably guessed, if we select the World, Asia, Russia, and the Central Federal District, the key will be taken from TOPO_ID4
Now, let’s complicate the task:
- If we select Russia and China, we need to find their common parent and the map of the corresponding level of nesting. Russia and China have the common parent Asia, which is one level up, so we need the map from TOPO_ID2
- If we select Russian Districts and US Districts, their common parent is the World, which is three levels higher. The required map is the map from TOPO_ID4
As you can see, you can select any level of complexity, and change the map selection logic by choosing specific maps for different attributes. For example, you can configure you dictionary so that the map always displays Asia as a whole whatever Asian territories is selected.
N.B. The same mechanism is used for drilling down to territories. Suppose that our map displays Russia. We double click the map to see its components. Once we double click the map, the Platform do the following:
- Selects elements under Russia element in the dictionary. In our case, federal districts
- Automatically selects the map in the same manner as described above. Guess what attribute will be used to select the map
N.B. If the map for this algorithm is not found in the associated TOPO_IDN attribute, the Platform will use TOPO_IDN-1 map, and so on.
The above algorithm is described in the help here.
How to keep map versioning
It happens that today a country exists, but tomorrow it is divided in two independent countries; or one day a region that belongs to a given federal district will be included in other district. In this situation, you want your map to change in time depending on the period of data display. So, what to do?
The answer is quite simple: do the same. Configure your dictionary as described above, but do not forget to select the versioned dictionary by checking the appropriate option in the dictionary edit wizard.
Each element will have its actual period. The map will take into account the actual period. See an example below with USSR and its dynamics in 1991. In addition, the cube must have a calendar dimension for managing territory dimension.
Benefit: If you select a map other than the default one, the automatic selection will be switched off. To activate the automatic selection, click the Return Default Map button in the Map tab on the tool ribbon.
You have gained insight into tips and hints of creating an efficient territory dictionary. You questions and comments are welcome.