-
Notifications
You must be signed in to change notification settings - Fork 0
Module 1c, Learning the basic concepts of GeoDMS, calculations over multiple domains
learning objective: Learning how to make calculations with multiple domains
In modelling, data often needs to be related and or (dis)aggregated between multiple domain units. In a relational database model, this is done by joins and group by statements.
In GeoDMS configurations, multiple domain units usually occur. Explicitly configured relations are used to calculate these different domain units.
A relation is an attribute that relates two domain units and is used if data is calculated between those domains.
The relation attribute indicates, for each element in domain unit A, what the related position (index number) in domain unit B is. So, for example, the first row in a municipality table relates to the third row in a province table.
The values unit of the relation are the positions in the related domain unit.
In module 1b, we learned that the domain unit defines the positions in a domain. Combining this results in the definition of a relation:
A relation is an attribute with domain unit: unit A and as values unit the domain unit: unit B. This attribute is needed to relate attributes between domain units A and B.
It is a naming convention to use the name of the domain unit with the suffix _rel as the name of the relation. So, a relation towards a country should be named country_rel.
By using relations index numbers, calculating attributes between domains becomes very fast.
The GeoDMS has multiple functions, resulting in a relation. In this module, we will look at 3 possible ways to make such a relation:
- based on attributes with code/keys that can be used to calculate a relation. Assume we have a CBS neighbourhood table with a CBS municipality code as an attribute. We can use the rlookup function to create a relation based on this attribute.
- use a geographic relation. For instance with the point in polygon function you can make a relation from a domain unit with a set of points and a domain unit with a set of polygons.
- based on a classification. With a classify functions numeric data items can be classified to class units.
More functions in the GeoDMS result in relations; see the function's specific signature.
Relations are used in calculations with attributes from different domain units. In this module, we will look at two examples:
- selections: Selections are made with a selection function. These functions results in a new domain unit, some with as a derived attribute a relation (org_rel) from the new selection domain unit towards the original domain unit. We often see the construction:
attribute<ValuesUnit> selection_att (selected_domain) := org_domain/att[org_rel];
The lookup function relates attributes from the original to the new selection domain.
- aggregations: With relations, aggregations can be configured, e.g. to calculate the number of inhabitants per municipality, based on the number of inhabitants per neighbourhood and the relation from neighbourhood to a municipality, with construction like:
attribute<nr_inh> nr_inhabitants (municipality) := sum(district/nr_inhabitants, district/municipality_rel);
In this exercise, you will make a relation from the 4-digit postcode point (PC4_point) to the 2-digit postcode point (PC2_point) and count the number of 4-digit postcode points (PC4_point) in a 2-digit postcode point (PC2_point).
- Download the project here and unzip the downloaded project file to a projDir like C:/prj/GeoDMSAcadamy.
- Open the file exercise.dms (in the GeoDMS_Academy\basics_multiple_domains\cfg subfolder of your downloaded project) with a text editor.
- Configure a new domain unit PC2_Points with the unique occurrences of PC2 codes in the PC4 domain. Tip: create a new attribute with the two left string characters of the PC4 code, and use the unique operator to configure the new domain unit].
- Create a relation from the PC4_Points domain towards the new PC2_Points domain.
- Next, try counting the number of PC4 points per PC2 point.
First, try to figure it out yourself. The configuration with the results is also available in the downloaded project; just open the result.dms file with the GeoDMS GUI in the cfg subfolder of your downloaded project.
Go to previous module: Module 1b, Learning the basic concepts of GeoDMS, understanding units
Go to next module: Module 1d, Learning the basic concepts of GeoDMS, classifying and visualising data
GeoDMS Academy
- 0: Install GeoDMS GUI and setup a configuration
- 1: Learning the basic concepts of GeoDMS
- 2: Loading and storing data sources
- 3: Basic analyses with vector data (WORK IN PROGRESS)
- 4: Basic analyses with grid data (WORK IN PROGRESS)
- 5a: Working with networks over a road network
- 5b: Working with networks in a public transport setting
- 6: Allocating land-use