Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
calc_distance_map [2026/06/29 13:20]
chrystian Add usage examples to functor documentation
calc_distance_map [2026/08/28 03:09] (current)
hermann Sync from local documentation review
Line 3: Line 3:
 ===== Description ===== ===== Description =====
  
-This functor calculates ​a map representing the frontage ​distance ​(in meters) between a cell and the closest ​cell of a certain category specified in the "​Categorical Map" input.+Calculates ​a map representing the Euclidean ​distancein meters, from every cell to the nearest ​cell belonging to each of a set of given categories.
  
 ===== Inputs ===== ===== Inputs =====
  
 ^ Name  ^ Type  ^ Description ​ ^ ^ Name  ^ Type  ^ Description ​ ^
-| Categorical Map | [[Categorical Map Type]] | Map of classes or categories. ​Null value cells on this map will produce ​the same null value cells on the resulting ​distance map. Data cell type of this map must be "​Signed 32 Bit Integer"​ or an error will be reported. ​+| Categorical Map  | [[Categorical Map Type]] ​ | Map of classes or categories ​for which distances are calculatedA null cell in this map produces a null cell at the same position in the distance map.  
-| Categories ​ | [[Int Set Type]] ​ | List of categories. Distance ​maps are calculated ​for these categories. Each category ​corresponds to a layer "​distance_to_i"​ where i is an identifier of a category on the input map.  |+| Categories ​ | [[Int Set Type]] ​ | Categories for which distance ​maps are calculated. Each category ​produces ​a layer named "​distance_to_i"​where i is the category'​s value in Categorical Map.  |
  
 ===== Optional Inputs ===== ===== Optional Inputs =====
  
-^ Name  ^ Type  ^ Description ​  ​^ Default Value  ^ +^ Name  ^ Type  ^ Description ​ ^ Default Value  ^ 
-| Cell Type  | [[Cell Type Type]] ​ | Data cell type.  | Signed 32 Bit Integer ​ | +| Cell Type  | [[Cell Type Type]] ​ | Cell type of the distance map.  | Signed 32 Bit Integer ​ | 
-| Null Value  | [[Integer ​Value Type]] ​ | Null value of the distance map.  | -2147483648 ​ | +| Null Value  | [[Null Value Type]] ​ | Null value of the distance map.  | -2147483648 ​ | 
-| Truncate Distance ​ | [[Boolean Value Type]] ​ | If true, distance ​values that exceed ​the greatest ​value of the output map will be truncatedinstead of informing ​an error. ​ | False. ​ |+| Truncate Distance ​ | [[Boolean Value Type]] ​ | If true, distance ​exceeding ​the largest ​value representable in the output map is truncated ​to that largest value instead of reporting ​an error. This is an advanced port.  | No  |
  
 ===== Outputs ===== ===== Outputs =====
  
 ^ Name  ^ Type  ^ Description ​ ^ ^ Name  ^ Type  ^ Description ​ ^
-| Distance ​ | [[Map Type]] ​ | The distance map. The distances ​are represented ​in meters. Map format has the same dimensions ​of the "Categorical Map". |+| Distance ​ | [[Map Type]] ​ | Map of distancesin meters, with the same dimensions ​as Categorical Map, and one layer per category in Categories |
  
 ===== Group ===== ===== Group =====
Line 29: Line 29:
 ===== Notes ===== ===== Notes =====
  
-The calculated distance ​is the [[wp>​Euclidean_distance|Euclidean distance]] and the unit used is the meter.+Raises an error if Categories ​is empty, or if the only category given corresponds to Categorical Map's null value.
  
-The output map has layers named "​distance_to_X",​ where X is the value of category for which the distances are being calculated. For instance, ​if the distance ​is being calculated for categories 2 and 13, the output map will have two layers named "​distance_to_2"​ and "​distance_to_13"​.+Raises an error if Null Value is not compatible with Cell Type.
  
 +Reports a warning if Cell Type could degrade performance.
  
 ===== Internal Name ===== ===== Internal Name =====
Line 41: Line 42:
  
 See practical examples of this functor in [[lesson_18|Lesson 18: Building a land-use and land-cover change simulation model]] See practical examples of this functor in [[lesson_18|Lesson 18: Building a land-use and land-cover change simulation model]]
 +