Select to view content in your preferred language

The AddLocations and Solve functions in the NA module cannot run consecutively

553
1
05-07-2022 01:52 AM
圈圈
by
Regular Contributor

I am creating a Python script to work with ArcGIS Pro. When I used the AddLocations and Solve functions in the NA module continuously, I found that only the former function worked and the latter function ran with an ERROR (ERROR 000840: this value is not a network analysis layer). The same thing happens when I change the order of AddLocations and Solve.

_0-1651913031255.png

In the image above, the Solve function works, but the AddLocations function fails.

_1-1651913405847.png

In addition, I found that this code runs correctly in Pro's native Python window, but fails when it is made into a geoprocessing tool.

Can any master please tell me why

1 Reply
圈圈
by
Regular Contributor

I've found out why.

When the second function passes in the network analysis layer "路径", the program recognizes a sublayer of the network analysis layer that is also named "路径".

0 Kudos