onstove.RasterLayer.get_distance_raster#

RasterLayer.get_distance_raster(method: str | None = None, output_path: str | None = None, mask_layer: VectorLayer | None = None, starting_points: Callable[[ndarray], ndarray] | None = None)[source]#

This method calls the specified distance calculation method.

It takes a method as input and calls the right method using either user predefined or default parameters. The calculated distance raster is then stored in the distance_raster attribute of the class.

Parameters:
method: str, optional

name of the method to use for the distance calculation. It can take “log”, “travel_time” or None as options. If “log” is used, then the log() method is called and a VectorLayer needs to be passed to the mask_layer parameter to be used for the calculation. If “travel_time” is used, then the travel_time() method is called and the starting_points need to be passed. If None is used, then the predefined ``distance_method` attribute of the RasterLayer class is used instead. If the previous is also None, then the raster itself is used as a distance raster.

output_path: str, optional

A folder path where to save the output dataset. If not defined then the distance raster dataset is not saved.

mask_layer: VectorLayer

Layer used to set to nodata every pixel of the raster outside the mask (used with the log method only).

starting_points: Callable object (function or lambda function) with a numpy array as input, optional

Function or lambda function describing which are the starting points to consider when calculating the travel time map (used with the travel_time method only).