AutoGIS15_FinalAssignment


Automating GIS-processes - Final work

Aim of the work:

Aim of the final assignment is to apply the programming techniques and skills that we have learned during the course and create a GIS tool called AccessHandler (see below instructions). You can choose yourself what tools / techniques / modules you want to use. You can either do the task by applying pure Python coding, arcpy or even ArcGIS ModelBuilder (not recommended though).

Write your codes into a single Python file and return the code to the Moodle (due date 2.12.2015 at 12:00). In the evaluation of the final work different functionalities of the code are evaluated individually. Thus, if you do not get all different parts / functionalities of the tool working, it is not the "the end of the world". It's good if you get at least some parts of the code working. Good documentation of the code will be highly regarded and will affect positively in the grading of the final work.

What the tool should do?

AccessHandler is a tool that is used for managing and helping to analyze MetropAccess-Travel Time Matrix (MTTM) data that can be downloaded from here. Read also the description of the dataset from the web-pages so that you get familiar with the data.

AccessHandler has two main functionalities:

1) It finds from the data folder all the matrices that user has specified by assigning a list of integer values that should correspond to YKR-IDs found from the attribute table of a Shapefile called MetropAccess_YKR_grid.shp. AccessHandler will create Shapefiles from the chosen Matrix text tables (e.g. travel_times_to_5797076.txt) by joining the Matrix file with MetropAccess_YKR_grid Shapefile (from_id in Matrix file corresponds to YKR_ID in the Shapefile) and saves the result in the output-folder that user has defined. You should name the files in a way that it is possible to identify the ID from the name (e.g. 5797076).

2) AccessHandler can also compare travel times or travel distances between two different travel modes (more than two travel modes are not allowed). Thus IF the user has specified two travel modes (passed in as a list) for the AccessHandler, the tool will calculate the time/distance difference of those travel modes into a new data column that should be created in the Shapefile. The logic of the calculation is following the order of the items passed on the list where first travel mode is always subtracted by the last one: travelmode1 - travelmode2. Notice that there are NoData values present in the data (with integer value -1). In such cases the result should always be integer value -1. The tool should ensure that distances are not compared to travel times and vice versa. If the user chooses to compare travel modes to each other, you should add the travel modes to the filename (e.g. "Accessibility_5797076_pt_vs_car.shp") If the user has not specified any travel modes, the tool should only create the Shapefile but not execute any calculations.

AccessHandler asks from the user three parameters:

  1. MatrixID (type: a list of integers)
  2. TravelModes (type: a list of strings with max length of 2)
  3. OutputFolder (type: a string containing a folder path)

With MatrixID parameter the user can pass a list of Travel Time Matrix ID-numbers (should be integers) for the program. If the ID-number that the user has specified does not exist in the data folders, the tools should warn about this to the user but still continue running. The tool should also inform the user about the execution process: tell the user what file is currently under process and how many files there are left (e.g. "Processing file travel_times_to_5797076.txt.. Progress: 3/25").

With TravelModes parameter the user can pass a list of travel modes that will be compared to each other (as described earlier). If this parameter is used, the length of the list should be exactly 2, otherwise, stop the program and give advice for the user how the parameter is used ("Parameter 'TravelModes' takes exactly two items"). Travel modes should be the same as are found in the actual TravelTimeMatrix file. Thus only five following values are accepted: 'Walk_time', 'Walk_dist', 'PT_total_time', 'PT_time', 'PT_dist'. If the user specifies something else, stop the program, and give advice what are the acceptable values.

With OutputFolder parameter the user defines the directory where the Shapefiles will be created.