Skip to content

Run AutoRoute Individual Items

Alan D. Snow edited this page Jun 1, 2016 · 1 revision

This provides a simple example for running a single AutoRoute process. There are many different configurations for running AutoRoute. AutoRoutePy allows you to change the parameters in the python code by name or through a AUTOROUTE_INPUT_FILE.txt.

from AutoRoutePy import AutoRoute
import os

autoroute_executable_location = '/AutoRoute/src/autoroute'
autoroute_input_path = '/autoroute-io/input/watershed-directory/sub_area-directory'
autoroute_output_path = '/autoroute-io/output/watershed-directory/sub_area-directory'

auto_mng = AutoRoute(autoroute_executable_location,
                     dem_raster_file_path=os.path.join(autoroute_input_path, 
                                                       'elevation.tif'),
                     stream_info_file_path=os.path.join(autoroute_input_path, 
                                                        'stream_info.txt'),
                     out_flood_map_raster_path=os.path.join(autoroute_output_path, 
                                                            'flood_map.tif')
                     )

#this functiona allows you to update your parameters for AutoRoute            
auto_mng.update_parameters(out_flood_map_shapefile_path=os.path.join(autoroute_output_path, 'flood_map_shp.tif'))

#this runs autoroute. However, the input file is not required.
auto_mng.run_autoroute(autoroute_input_file=os.path.join(autoroute_input_path,
                                                         'AUTOROUTE_INPUT_FILE.txt'))
Clone this wiki locally