Skip to main content
replaced http://gis.stackexchange.com/ with https://gis.stackexchange.com/
Source Link

Couple of general suggestions. Not really a Network Analyst expert, but hopefully these apply.

  • really look at what needs to within the looping structure. I'm probably not understanding all the logic in there, but it does seem like there are some variables and operations that would yield the same result with each iteration (particularly at the beginning of the loop).
  • is there a way to avoid using the Append operation inside your looping? This is a relatively expensive operation. In the past, I've created a numpy array within a loop and then used arcpy.da.numpyArrayToFeatureClass to ingest all of that information at once (see my response to another question for an examplesee my response to another question for an example).
  • I'm guessing the arcpy.na.Solve operation is pretty expensive. Does this need to be solved iteratively or can it be done once all the arcpy.na.AddLocations operations are done? For that matter, if you collect all the locations within the loop, can the arcpy.na.AddLocations be done below the loop (could use numpy arrays, or even just a list of point geometries)?
  • is it necessary to create outGeographicalAreaCentroidsSelection? Can the selection on the original feature layer be used as input to AddLocations instead?
  • can the two SelectLayerByAttribute_management operations be merged into one?

Couple of general suggestions. Not really a Network Analyst expert, but hopefully these apply.

  • really look at what needs to within the looping structure. I'm probably not understanding all the logic in there, but it does seem like there are some variables and operations that would yield the same result with each iteration (particularly at the beginning of the loop).
  • is there a way to avoid using the Append operation inside your looping? This is a relatively expensive operation. In the past, I've created a numpy array within a loop and then used arcpy.da.numpyArrayToFeatureClass to ingest all of that information at once (see my response to another question for an example).
  • I'm guessing the arcpy.na.Solve operation is pretty expensive. Does this need to be solved iteratively or can it be done once all the arcpy.na.AddLocations operations are done? For that matter, if you collect all the locations within the loop, can the arcpy.na.AddLocations be done below the loop (could use numpy arrays, or even just a list of point geometries)?
  • is it necessary to create outGeographicalAreaCentroidsSelection? Can the selection on the original feature layer be used as input to AddLocations instead?
  • can the two SelectLayerByAttribute_management operations be merged into one?

Couple of general suggestions. Not really a Network Analyst expert, but hopefully these apply.

  • really look at what needs to within the looping structure. I'm probably not understanding all the logic in there, but it does seem like there are some variables and operations that would yield the same result with each iteration (particularly at the beginning of the loop).
  • is there a way to avoid using the Append operation inside your looping? This is a relatively expensive operation. In the past, I've created a numpy array within a loop and then used arcpy.da.numpyArrayToFeatureClass to ingest all of that information at once (see my response to another question for an example).
  • I'm guessing the arcpy.na.Solve operation is pretty expensive. Does this need to be solved iteratively or can it be done once all the arcpy.na.AddLocations operations are done? For that matter, if you collect all the locations within the loop, can the arcpy.na.AddLocations be done below the loop (could use numpy arrays, or even just a list of point geometries)?
  • is it necessary to create outGeographicalAreaCentroidsSelection? Can the selection on the original feature layer be used as input to AddLocations instead?
  • can the two SelectLayerByAttribute_management operations be merged into one?
Source Link
Roland
  • 1.3k
  • 9
  • 21

Couple of general suggestions. Not really a Network Analyst expert, but hopefully these apply.

  • really look at what needs to within the looping structure. I'm probably not understanding all the logic in there, but it does seem like there are some variables and operations that would yield the same result with each iteration (particularly at the beginning of the loop).
  • is there a way to avoid using the Append operation inside your looping? This is a relatively expensive operation. In the past, I've created a numpy array within a loop and then used arcpy.da.numpyArrayToFeatureClass to ingest all of that information at once (see my response to another question for an example).
  • I'm guessing the arcpy.na.Solve operation is pretty expensive. Does this need to be solved iteratively or can it be done once all the arcpy.na.AddLocations operations are done? For that matter, if you collect all the locations within the loop, can the arcpy.na.AddLocations be done below the loop (could use numpy arrays, or even just a list of point geometries)?
  • is it necessary to create outGeographicalAreaCentroidsSelection? Can the selection on the original feature layer be used as input to AddLocations instead?
  • can the two SelectLayerByAttribute_management operations be merged into one?