Arcpy Network Analyst Solve Failure

4052
4
Jump to solution
05-16-2016 01:21 PM
Highlighted
New Contributor III

While using the Network Analyst Closest Facility task in a python script, my solve operation is failing on incidents that have been located on disconnected network segments.  I have tried to use:

arcpy.Solve_na(cf_layer, terminate_on_solve_error=False, ignore_invalids=True)

but then the routes feature is never populated with any data at all, even for incidents that do have a solution.

When I run this same operation in ArcMap, solve executes properly with the addition of a warning window displaying the incidents solve was not able to find a solution for.

This brings me to my question:

1. Is there a way in python for solve to complete on all other features that do have a valid solution so I can continue with my analysis?  If not,  am I able to access the Network Analyst warning window within python so I can filter out incidents I know will fail?

Thanks in advance,

Joe

Reply
0 Kudos
1 Solution

Accepted Solutions
Highlighted
New Contributor III

For anyone else experiencing something similar,

It turns out that by deleting and recreating the network dataset, all of the operations began to function as expected.

View solution in original post

Reply
0 Kudos
4 Replies
Highlighted
MVP Esteemed Contributor

did you try 'skip' and 'continue'

Solve_na (in_network_analysis_layer, {ignore_invalids}, {terminate_on_solve_error}, {simplification_tolerance})

Solve—Help | ArcGIS for Desktop

Reply
0 Kudos
Highlighted
New Contributor III

Unfortunately, I get the same result using the string version of the parameters.

Reply
0 Kudos
Highlighted
MVP Esteemed Contributor

then you should have had errors or warnings indicating what was wrong... check the help options in more detail ie.

  • SKIP —The solver will skip over network locations that are unlocated and solve the analysis layer from valid network locations only. It will also continue solving if locations are on nontraversable elements or have other errors. This is useful if you know your network locations are not all correct, but you want to solve with the network locations that are valid.
  • HALT —Do not solve if there are invalid locations. You can then correct these and re-run the analysis.
Reply
0 Kudos
Highlighted
New Contributor III

For anyone else experiencing something similar,

It turns out that by deleting and recreating the network dataset, all of the operations began to function as expected.

View solution in original post

Reply
0 Kudos