Best tips for migrating an arcpy.na script from ArcMap 10.6.1 to Pro 2.5?

3181
10
07-22-2020 07:11 AM
JordanKing1
New Contributor II

Previously, I was working in ArcMap 10.6.1 and created a script utilizing the arcpy.na module.  I had no Python background prior to this rather large undertaking, so my (still limited) Python knowledge is based in ArcGIS.

The purpose of this script was to iterate through a set of polygons, select the intersecting points in each polygon, load these points into a new Network Analysis Route layer, solve that route, then move on to the next polygon and repeat. 

It was working pretty well! Then, I decided to migrate to Pro 2.5...

I was successful in most of my gp tool migrations. However, there are 2 major "module-based" issues I am having:

1. I am having difficulty understanding how to migrate from the arcpy.mapping module to the arcpy.mp module in Pro.

2. I've been a little confused with the differences between the .nax module and the legacy .na module, even after reading the "choose your module" help page. The .nax module seems much simpler and more straightforward, but it appears to not have the ability to create network analysis layers. That is the main function of my script. 

I feel as though I am back at square one trying to navigate these migrations. Does anyone have any experience moving to these new modules? Is anyone else in the same boat as me?

0 Kudos
10 Replies
JordanKing1
New Contributor II

I think I figured it out!

I was trying to re-run my script after fixing a different error. I had env.overwriteOutput = True at the top of my script, but for some reason I think it wasn't actually overwriting the NA Layers in the file gdb. I have read that it's a common error with newer versions of Pro on some features for whatever reason.

Once I removed the previously created NA Layer from my last script attempt, the new NA Layer was created without error and my stops were added with AddLocations just fine. Hopefully this helps for anyone else having similar issues!

Thanks again for all your help, Melinda. My scripts are both working great now with .nax, .na, and .mp utilization!

0 Kudos