Closed doggett-sarah closed 5 years ago
Hello @doggett-sarah. I'm pretty sure I installed a fix for that KeyError a while back (see https://github.com/Esri/public-transit-tools/issues/78). Please download the latest version from http://arcg.is/10jXez and try again. Let me know if this doesn't resolve the problem!
@mmorang I downloaded the tool after that fix was installed (July/August 2018). I will download the new version but I don't think that is the source of the problem
Okay, then it must be a different issue. Can you further explain what this means? "I just changed the settings on the network analysis layer so the origins/destinations snapped to the correct streets."
I need enough detail so I can reproduce your steps. This will hopefully allow me to reproduce the problem and find a solution for it.
I am trying to calculate the accessibility of census block groups in a county to various types of destinations using transit, during three different time periods. To do this, I’ve created a series of models in ModelBuilder that have been aggregated into one master model that I can leave running on my computer overnight. I don’t think the problem is in the master model, as the same error occurred when I ran one of the submodels by itself.
I had calculated the Transit Accessibility before without error on the part of the tool. However, I later realized that I had not configured the OD Cost Matrix network analysis layer with the correct analysis settings (https://github.com/Esri/public-transit-tools/blob/master/add-GTFS-to-a-network-dataset/UsersGuide_TransitAnalysisTools.md) which meant that some of my origins and destinations were shown as inaccessible when they should have been accessible. I followed the instructions in Step 8 of the Add GTFS to Network Dataset user guide and changed the network locations tab so that for origins and destinations, only “Streets_UseThisOne” was checked. I think this solved my initial problem as the tool only crashes after running the network analysis and all of the origins/destinations that should be accessible are. However, now I have this new problem. The only other thing I changed was that I increased the Time Increment from 5 minutes to 10 minutes so the model would run quicker.
Do you have any ideas about what is happening? I have to finish up this research very soon.
I suspect the problem has something to do with the fact that you have used the input OD Cost Matrix layer more than once, so it deleted all the origins and destinations and re-loaded them. This causes the OIDs in the Origins and Destinations sublayers to not start with 1 (it starts with the next number after the ones that were cleared out). This should work, but there is probably a bug in the tool causing this not to work. I will definitely investigate and fix this as time allows. However, the fastest way for you to get going again is probably to just create a fresh OD Cost Matrix layer, set up the settings correctly from the beginning, and try again.
I did that and it seems to be working now. Thank you!
I'm glad you've got it working. I played around with a few different cases, but I was unable to reproduce the problem. I checked the code, and it should be correctly handling the situation mentioned above.
Did you ever see this problem when running the tool by itself, or was it always in your model? Is it possible your sub-models or the master model are using the same OD Cost Matrix layer simultaneously somehow?
I'd still like to track down the problem, but never mind if you've got it working and don't have time for further experimentation.
Closing this issue because the problem with the user's model was resolved.
I really need help with this! The tool worked previously, I just changed the settings on the network analysis layer so the origins/destinations snapped to the correct streets. And now I'm getting this error message. Does anyone know what's wrong?
Start Time: Tue Sep 25 14:23:33 2018 Running script CalculateAccessibilityMatrix... Adding Origins and Destinations to OD Cost Matrix Layer... Solving OD Cost matrix at time... 2018-05-22 11:00:00 2018-05-22 11:10:00 2018-05-22 11:20:00 2018-05-22 11:30:00 2018-05-22 11:40:00 2018-05-22 11:50:00 2018-05-22 12:00:00 2018-05-22 12:10:00 2018-05-22 12:20:00 2018-05-22 12:30:00 2018-05-22 12:40:00 2018-05-22 12:50:00 2018-05-22 13:00:00 Calculating statistics and writing results... Failed script CalculateAccessibilityMatrix... Traceback (most recent call last): File "c:\program files (x86)\arcgis\desktop10.6\ArcToolbox\Toolboxes\scripts\CalculateAccessibility.py", line 210, in
origin_OID = origins_oid_dict[row[0]]
KeyError: 1