I am hoping to implement the Calculate Travel Time Statistics component of the Public Transit Evaluator in ArcPy. I have come across documentation related to using the Public Transit Evaluator through the ArcGIS Pro GUI (Public Transit evaluator—ArcGIS Pro | ArcGIS Desktop ) and (public-transit-tools/UsersGuide.md at master · Esri/public-transit-tools · GitHub ), but I haven't been able to find any documentation related to using this function through ArcPy. Would anyone happen to have come across this documentation or know how to call the function/how to set the relevant parameters through ArcPy?
Hi Robert. Here is the documentation for the Calculate Travel Time Statistics tool, in case you didn't find it: public-transit-tools/UsersGuide.md at master · Esri/public-transit-tools · GitHub
You're right that the documentation doesn't give you the python parameter names, though. If you find the toolbox in the Catalog pane in ArcMap or Pro, you can right-click on the tool it and choose Properties. On the Parameters tab of the Properties window, you can see the list of the parameters. Instead of using the values in the Label column (that's what displays in the tool dialog), you can use the values in the Name column. Those are the python keywords. You can also run the tool once manually in the map, then right-click the result and copy the python snippet. You may need to change the input and output data paths to make it work, but the syntax should be pretty much as expected from arcpy.
I am trying to implement CalculateTravelTimeStatistics tool in arcpy and I have used the python snippet from earlier runs of the tool. I have saved my OD Matrix network analysis layer as .lyrx file (ArcGIS Pro) and entered the input and output data file paths in the python snippet. But, when I run the script, I get the following error code:
"ExecuteError: Failed to execute. Parameters are not valid.
ERROR 000732: Input Network Analyst Layer: Dataset C:\Users\pveginadu\Documents\ArcGIS\Projects\FCA_Refugees\OD_CostMatrix\PTODM.lyrx does not exist or is not supported
Failed to execute (CalculateTravelTimeStatistics)."
I have checked the entered file path and it is correct. I am unable to figure where am I doing it wrong. Any help would be much appreciated.
If you add that saved .lyrx file to Pro, does it load up in the map as a valid OD Cost Matrix layer (ie, it shows up in the map, it's not broken, and you can see the purple OD Cost Matrix tab)?
When you use the Save To Layer File tool, sometimes it gives you two option of which layer to save that have the same name, like "OD Cost Matrix". The first one is usually the actual Network Analyst layer, and the second one is a regular group layer representation of the layer. If you save the second one, it loses its special Network Analyst stuff. I realize this is kind of strange, and I don't know why it works like this, but it seems possible that this is what happened to you.