Change domain of table
Functionality / Algorithm
The Change domain of table operation copies the contents of an input table to a new table; the new table will have another domain than the input table.
For the domain of the output table, you can choose:
- domain None;
- an existing class or ID domain on disk;
- a class or ID domain of a column in the input table when that column contains unique classes or IDs;
- a class or ID domain of a column in the input table where the column does not contain unique classes or IDs and other column values need to be aggregated (average, minimum, maximum, sum, last value encountered).
Explanation:
- When you choose to obtain an output table with domain None:
- All records of the input table will be written into the output table.
- The order of records in the input and in the output table is the same.
- When you choose to obtain an output table with an existing class or ID domain on disk:
- The domain items of the input table will be compared with the domain items in the selected domain; when an item (i.e. a class name or an ID) exists in both domains, then the record is written into the output table.
- The order of records in the output table will be the order of the selected domain.
- You may use this option when you have a table which contains records for all classes or IDs in a domain and when you want to obtain a table with only a few records on a few classes or IDs of the input table; create a new domain with only a few classes or IDs (a subset), then use the Change domain of table operation and select the domain with the subset.
- You may also use this option after importing tables and when you know that the imported tables should use the same domain.
- When you choose to obtain an output table which will use the domain of a column in the table and when each field of that column contains another class name or ID, i.e. when the fields in the selected column are unique:
- For each unique class name or ID, the values found in other columns in the input table will be written into the output table.
- The order of records in the output table will be the order of the domain of the selected column.
- When the class names or IDs in the selected column are not unique and when you do not choose the Aggregate option, an error message will follow.
- When you choose to obtain an output table which will use the domain of a column in the input table and when the fields of that column do not contain unique class names or IDs, choose the Aggregate option.
- For each group of class names or IDs found in the selected column, the values found in all value columns will be aggregated by taking either the average, minimum value, maximum value, or the sum; the answers are then written into the output table. You can also choose to simply use the last value encountered per group of class names or IDs.
- When an aggregation on an input column is not possible, i.e. when an input column does not have a value domain, the last class name, ID, color, etc. encountered per group will be written into the output table.
- When you use the Average aggregation function, the precision of output value columns will differ from the precision of the input value columns.
- When you use the Sum aggregation function, the value range of output value columns will differ from the value ranges of the input value columns.
- The order of records in the output table will be the order of the domain of the selected column.
- An extra column Count will appear in the output table; it contains the number of times that a certain class name or ID was found in the selected column.
Requirements for the input table:
No special requirements.
Domain of output table:
The domain of the output table will be the domain which you selected: domain None, an existing class or ID domain on disk, or a class or ID domain of a column in the input table.
The output table will contain an extra column Count when an aggregation function is used.
Tip:
The Change domain of table operation can only use one type of aggregation function which will be applied on all value columns in the input table. When you want to use different aggregation functions for various columns or when you want to use weight functions for an aggregation, it is advised to use the Join Column command on the Columns menu of the 'output' table.
See also:
Change domain of table : dialog box
Change domain of table : command line
ILWIS objects : domains