I created a tool that uses service areas to group points that are within a certain distance from one another along a network (in my case, a river system). Overall, the tool works. However, when I run it, the Generate Service Areas geoprocessing step does not produce polygons around all input point 'facilities' when run with the Python code.

I tried running the same datasets manually with the Network Analyst toolbar and window and all polygons were successfully created. I also tried running the same dataset through the Generate Service Areas geoprocessing tool and it also generated all polygons as expected.

However, when I run the Python code snippet from the Python window or from within my custom tool, it randomly skips polygon creation for several of the point 'facilities'. This is my code snippet for the generate service areas step:

species_pts = 'species_pts'
sep_distance = 500
scratchGeodatabase = r'C:\Users\mmoore\Documents\ArcGIS\Default.gdb'

Anyone have an idea as to why this may be somewhat randomly skipping polygon creation around several points?

  • 1
    Does your "species_pts" have a selection on it? If in Python window and you're running this code seemingly against a layer, and there is a selection of only "some points", that'll impact your final output result.
    – KHibma
    Sep 18, 2018 at 19:13
  • There is not a selection on it. I have also tried running it directly from the data source (not the layer file).
    – mmoore
    Sep 18, 2018 at 19:31

1 Answer 1


This sounds to me as if some of the points to get properly located when you run the GP tool. There is a nasty (but often times handy) option "Exclude restricted portions of the network" which is something you define when creating a Service Area NA layer. It can make it possible to locate the source points on the next allowed edge, but when you run the tool from Python, it may locate it on a restricted edge (say, oneway=N) thus making a point non-routable.

Try using the GP tool Make Service Area Layer, then Add Locations, and then finally Solve. If you are able to create service area polygons around all of your points by doing this, then you could copy Python snippets and run the code from Python window or as a stand-alone script (with minor modifications).

Just to be clear, you do not use the Network Analyst toolbar at all when testing this.

If it does work when you run the GP tools, but when running the Python code some of the points do not get polygons created, I'd start looking into the cut-off and default break value settings. There have been a bug in Network Analyst when a different cut-off and break values are used when you specify not a single cut-off value but rather when each point has its own one (read from an attribute).

I had to work around this by setting a ridiculously large value for default_break_values to be able to use different break values for each point.

  • I used Make Service Area Layer, Add Locations, and Solve in my script and it all has been working fine and creating all polygons as expected. I used arcpy.mapping.ListLayers() to extract the service area lines and polygons that I needed. Although it's several more steps and I still am baffled why Generate Service Area was so inconsistent, this method is working more reliably, so I'll go with it. Thanks for your help!
    – mmoore
    Sep 19, 2018 at 15:49
  • Ah, so glad you got it working, awesome. Keep in mind that Generate Service Areas GP tool is supposed to be used only for publishing your tool as a GP service which is why it is located under the Server toolset. Sep 19, 2018 at 16:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.