2

I'm modelling accessibility, so am using network analyst arcpy.na.MakeServiceAreaAnalysisLayer().

However, I don't want to enter anything for the time_of_day parameter. How do I write my Python script so that I can write parameters after this, but not include time_of_day or time_zone?

I get ERROR 000628: Cannot set input into parameter time_of_day.

I'm a newbie to scripting.

4

If you do not wish to enter a value for a parameter, you'd typically pass it an empty string. The time_of_day parameter is the 6th parameter (or so I read from the doc).

arcpy.na.MakeServiceAreaAnalysisLayer(network, layer_name,
                                                travel_mode, "FROM_FACILITIES",
                                                [3], "", polygon_detail="HIGH",
                                                geometry_at_overlaps="OVERLAP")

However, only the input network parameter is required. You should be able to run the tool just like:

arcpy.na.MakeServiceAreaAnalysisLayer(network)

Or, if you only want to provide one optional parameter that isn't the first and not pass in a bunch of empty strings, you can pass a value to the assigned parameter like so:

arcpy.na.MakeServiceAreaAnalysisLayer(network, geometry_at_overlaps="OVERLAP")

(The geometry_at_overlaps is actually the 10th parameter)

To answer the question in the comment, how to use all parameters up till geometry_at_cutoffs, but skipping time_of_day and time_zone:

arcpy.na.MakeServiceAreaAnalysisLayer(network, layer_name,
                                    travel_mode, "FROM_FACILITIES", [1, 2, 3],
                                    time_of_day="",
                                    time_zone="",
                                    output_type="LINES",
                                    polygon_detail="HIGH",
                                    geometry_at_overlaps="OVERLAP",
                                    geometry_at_cutoffs="RINGS")

(I started making them named parameters for ease of seeing what parameter is where)

3
  • Thank you, thats helpful! Although I want to use parameters up until geometry_at_cutoffs, just missing the time_of_day and time_zone, would the above still be applicable?
    – JGe
    Jan 4 '17 at 22:02
  • Good answer. I would include a link to the official documentation: pro.arcgis.com/en/pro-app/tool-reference/network-analyst/…
    – Mintx
    Jan 4 '17 at 22:03
  • @JGe I added one more example for what you're doing specifically.
    – KHibma
    Jan 5 '17 at 14:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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