district - ObjectVision/GeoDMS GitHub Wiki
Grid functions district
- district(grid_data_item)
The district function is used to find adjacent (horizontal & vertical, not diagonal) grid cell values with the same values.
district(grid_data_item) results in a new uint32 domain unit, with a generated subitem: Districts.
If two adjacent cells have the same value in the grid_data_item argument, they will get the same district value.
The Districts attribute has the same domain unit as the grid_data_item and contains a relation to each district (zero based).
In earlier versions of the GeoDMS adjacency was also defined in diagonal directions, the district_8 function defines adjacent also in diagonal directions.
The variants district_uint8 and district_uint16 (and district_4_ and district_8_ with the same suffixes) result in a uint8 or uint16 domain unit, for at most 255 or 65535 districts. Since GeoDMS 20.23.1 one district more is an error. Before, exactly 256 (65536) districts resulted in a domain unit without elements, while the cells referred to districts 0 to 255, and only one district more was reported.
- attribute grid_data_item with uint8 or uint32 value type
The domain unit of the grid_data_item argument must be a Point value type of the group CanBeDomainUnit.
unit<uint32> unit_district := district(sourcegrid);
sourcegrid
| null | 0 | 0 | 0 | 1 |
| 0 | 0 | 2 | 1 | 1 |
| 0 | 2 | 3 | 3 | 3 |
| 1 | 1 | 1 | 3 | 0 |
| 0 | 1 | 0 | 1 | 3 |
Table GridDomain, nr of rows = 5, nr of cols = 5
unit_district/districts
| null | 0 | 0 | 0 | 1 |
| 0 | 0 | 2 | 1 | 1 |
| 0 | 3 | 4 | 4 | 4 |
| 5 | 5 | 5 | 4 | 6 |
| 7 | 5 | 8 | 9 | 10 |
Table GridDomain, nr of rows = 5, nr of cols = 5