Bug When Solving Network Analysis Problem

832
9
09-14-2017 01:46 PM
Highlighted

I have a script tool that repeatedly solves an OD Cost Matrix problem using the method:

arcpy.na.Solve(in_network_analysis_layer)

A month ago or so I was using ArcGIS 10.5 and the script would run fine either as a stand-alone script or as a script tool within ArcMap/ArcCatalog. I recently upgraded to ArcGIS 10.5.1 and the script will only run within ArcMap if I reference an OD Cost Matrix Layer within the map document. It will not run otherwise.

The error message I've been getting is that the layer I'm using as an input is not a network analyst layer. However, I have confirmed that it is indeed a NA layer by using the method isNetworkAnalystLayer. I have even used this property right above the line of code that solves the problem.

I think this is a bug. I have never really used this forums and ESRI support, but I was not able to find a way of reporting it as a bug.

Does anyone have any ideas?

Reply
0 Kudos
9 Replies
Highlighted
MVP Esteemed Contributor

arcpy.na.solve help

Whats new in network analyst an Overrides parameter was added to Solve in 10.5

Hard to say, but there have been some subtle changes that may be affecting your workflow... worth a look 

Reply
0 Kudos
Highlighted

My apologies. I meant to say that I upgraded from 10.5 to 10.5.1. And thanks, I looked into it and that doesn't really say anything that is related to my issue. I was hoping to see if some people are having the same issue or if it's just me in an attempt to isolate the problem.

Reply
0 Kudos
Highlighted
MVP Esteemed Contributor

yes, there is nothing in the 10.5 changelog, and I assume nothing 'happened' between 10.5 and 10.5.1 that would affect things (ie change in your python installation, new ide..., project moved, cleaned up some files... endless possibilities)  Good luck

Reply
0 Kudos
Highlighted
Esri Contributor

A few questions for you:

Could you attach a copy of your script? Or at least the parts of it that set up and run the ODCM? Also, if you make a model for the ODCM, export it to a python script, and run that, does that work? And what is the exact error message you are getting?

Reply
0 Kudos
Highlighted
Esri Contributor

Update: I just took the MakeODCostMatrixLayer example 3 (workflow) from Make OD Cost Matrix Layer—Help | ArcGIS Desktop  , pasted it into a new py file, changed the data path, and it worked fine. So I'd really want to see your script and what else is going on in it.

Highlighted

I am not creating a ODCM layer within the script. I am loading an existing one where I have predefined the parameters. Just like this:

Reply
0 Kudos
Highlighted
Esri Contributor

So that error message does not indicate to me that it is not recognizing the NA layer as an NA layer. My thought is that there is a parameter in the NA layer that is not the correct type. I would print out the properties of the ODCM layer (ODCostMatrixSolverProperties—Help | ArcGIS Desktop ) and check each parameter, see what type of object it is and that it matches what it should be. Also check the origins and destinations and make sure they all look good.

If you make a new NA layer with the exact same properties and use that in your script, do you still get the error? And can you solve the analysis in ArcMap using that same NA layer that is giving you problems now?

If you have support, you can also create a support ticket for this, so you can get more directed help (Though you'd probably get many of these same questions from the support analyst who takes the case).

Reply
0 Kudos
Highlighted
MVP Esteemed Contributor

There was no difference between 10.5 and 10.5.1 with one parameter added in 10.5 which means the documentation is incorrect, since it 'worked' in 10.5, or something has indeed changed

Reply
0 Kudos
Highlighted

I figured out what the problem was. Nothing other than lack of attention, for which I apologize. I was moving the layer file around, and therefore the paths to the source data got broken -.-

Just like when people are new to ArcGIS and they think map documents are everything they need.

And that is the reason why it was only working within ArcMap. It was the only place where my OD Cost Matrix Layer actually had source data.

I saved a new layer file and everything worked fine. Thank you guys for the help. I really appreciate it!

Reply
0 Kudos