AnsweredAssumed Answered

How to use the Generate Service Areas in Python

Question asked by atobin15 on Jan 25, 2017
Latest reply on Jan 30, 2017 by atobin15

Hi All,

 

I am trying to use the Generate Service Areas tool in python. I used Model Builder to fill in my perimeters and exported it to a python script. I then cleaned the code up because the tool uses barriers that are in memory. I'm using the ESRI 10.2 Streets SDC.

 

I am getting the error: 

ExecuteError: ERROR 000622: Failed to execute (Generate Service Areas). Parameters are not valid.
ERROR 000800: The value is not a member of USE_HIERARCHY | NO_HIERARCHY.

I put breaks in the code so I could try to figure out what part had an issue. The error is thrown on line 36 which is the input that comes after Travel_Mode. In the help there are no perimeters after Travel_Mode but in ArcMap the results input shows 'Overrides:'. I'm not trying to do anything fancy just the bare bones.

 

Any help would be greatly appreciate! 

 

This is my code: 

# Import arcpy module
import arcpy
arcpy.CheckOutExtension("Network")

# Local variables:
PDS1 = "Z:\\Amber\\Geocodes\\AGO\\Cert Geodatabase.gdb\\Opioid_Treatment_Program_Methadone_Clinic"
Break_Values = "30"
Break_Units = "Minutes"
streets = "Z:\\ArcGIS\\10.2\\streetmap_na\\data\\streets4"
Attribute_Parameter_Values = "Z:\ArcGIS\10.2\streetmap_na\data\Attribute_Parameter_Values.dbf"
Drive_Times = "Z:\\Amber\\Geocodes\\AGO\\Cert Geodatabase.gdb\\Drive_Times2"
Solve_Succeeded = "true"
Output_Network_Analysis_Layer = ""
restrictions = "'Driving a Passenger Car';'Avoid Service Roads';'Avoid Pedestrian Zones';'Avoid Walkways';'Avoid Roads for Authorities';'Avoid Private Roads';'Avoid Unpaved Roads';'Through Traffic Prohibited';'Avoid Express Lanes';'Avoid Carpool Roads'"
attribute = "Z:\ArcGIS\10.2\streetmap_na\data\cfcc.sdc"

# Process: Generate Service Areas
arcpy.GenerateServiceAreas_na(PDS1, Break_Values, Break_Units, streets, Drive_Times, "TRAVEL_TO", "",\
"ALLOW_UTURNS", "Time", "Minutes", "Length", "Miles", "USE_HIERARCHY",\
restrictions,\
Attribute_Parameter_Values,\
"20 Kilometers", "EXCLUDE", "\"SDC Edge Source\" #", "NO_MERGE", "RINGS", "SIMPLE_POLYS", \
"", "10 Meters", "", "", "", "", "",\
"", "", "", "", \
"NO_SAVE_OUTPUT_LAYER", \
"GEO_LOCAL", \
"CUSTOM"\
"")

Outcomes