onstove.RasterLayer.travel_time#
- RasterLayer.travel_time(rows: ndarray, cols: ndarray, include_starting_cells: bool = False, output_path: str | None = None, create_raster: bool | None = True) RasterLayer [source]#
Calculates a travel time map using the raster data as cost surface and specific cells as starting points.
This method uses the data of the current
RasterLayer
as a cost surface, to calculate the distance-weighted minimum cost map from specific cells (rows
andcols
) to every other cell in the cost surface. It makes use of the skimage.graph.mcp.MCP_Geometric class.- Parameters:
- rows: np.ndarray
Row indexes of the cells to consider as starting points.
- cols: np.ndarray
Column indexes of the cells to consider as starting points.
- include_starting_cells: boolean, default `False`
Indicates whether to include the cost of the starting cells in the least cost path calculation.
- output_path: str, optional
A folder path where to save the output dataset. If not defined then the travel time dataset is not saved to disk.
- create_raster: bool, default True
Boolean condition. If True, a
RasterLayer
will be created and stored in thedistance_raster
attribute of the class. If False, aRasterLayer
with the travel time calculation is returned.
- Returns:
- RasterLayer
RasterLayer
with the least-cost travel time data.