arcpy.AddIDMessage("WARNING", 30109) arcpy.AddIDMessage("WARNING", 30127, report_value_with_units) else: arcpy.AddIDMessage("ERROR", 30119, "Force Hierarchy beyond Distance") raise nau.InputError() #Throttling Check 5: Check if the number of barrier features (point, line and polygon) are within maximum allowed load_point_barriers, load_line_barriers, load_polygon_barriers = nau.check_barriers( point_barriers_obj, line_barriers_obj, polygon_barriers_obj, max_features_point_barriers, max_features_line_barriers, max_features_polygon_barriers, desc_nds) ##Perform the closest facility analysis as all throttling conditions are met. #Get the restrictions and accumulate attributes that are valid for the network dataset if restrictions: restrictions_to_use = nau.get_valid_attributes(desc_nds_attributes, restrictions) else: restrictions_to_use = [] #Determine the accumulation attributes to use #Get only the attributes that are valid for the current network dataset. if accumulate_attributes: accumulate_attributes = nau.get_valid_attributes( desc_nds_attributes, accumulate_attributes, "Cost", 30128) #remove time attribute and distance attribute from the list of accumulate attributes as we will manage #these attributes seperately. if time_attribute in accumulate_attributes: accumulate_attributes.remove(time_attribute) if distance_attribute in accumulate_attributes: accumulate_attributes.remove(distance_attribute)
polygonType = "DETAILED_POLYS" else: polygonType = "SIMPLE_POLYS" #Add an extra break so that we get better polygons without trimming if useExtraBreak: extraBreakValue = locale.str(round(converetedEndBreakValue * EXTRA_BREAK_VALUE_FACTOR, ROUND_PRECISION)) convertedBreakValueList.append(extraBreakValue) #Use only those restrictions that are supported by the network dataset. If the user supplied #restriction list contain un-supported restrictions, add a warning message. #Get the restrictions and accumulate attributes that are valid for the network dataset if restrictions: restrictions_to_use = nau.get_valid_attributes(descNDSAttributes, restrictions) else: restrictions_to_use = [] #Make a new service area layer saLayer = arcpy.na.MakeServiceAreaLayer(networkDataset, NA_LAYER, impedanceAttribute, travelDirection, " ".join(convertedBreakValueList),polygonType, polygonMerge, polygonNestingType,"NO_LINES","OVERLAP","NO_SPLIT", "", "", uturnPolicy, restrictions_to_use, trimPolygons, polygonTrimDistance, "NO_LINES_SOURCE_FIELDS", useHierarchy, arriveDepartTime).getOutput(0) saLayerExists = True saLayerSolverProps = arcpy.na.GetSolverProperties(saLayer) #Set the timeZoneUsage if timeOfDay is specified if arriveDepartTime: saLayerSolverProps.timeZoneUsage = timeZoneUsage
raise nau.InputError() # Throttling Check 5: Check if the number of barrier features (point, line and polygon) are within maximum allowed load_point_barriers, load_line_barriers, load_polygon_barriers = nau.check_barriers( point_barriers_obj, line_barriers_obj, polygon_barriers_obj, max_features_point_barriers, max_features_line_barriers, max_features_polygon_barriers, desc_nds, ) ##Perform the closest facility analysis as all throttling conditions are met. # Get the restrictions and accumulate attributes that are valid for the network dataset if restrictions: restrictions_to_use = nau.get_valid_attributes(desc_nds_attributes, restrictions) else: restrictions_to_use = [] # Determine the accumulation attributes to use # Get only the attributes that are valid for the current network dataset. if accumulate_attributes: accumulate_attributes = nau.get_valid_attributes(desc_nds_attributes, accumulate_attributes, "Cost", 30128) # remove time attribute and distance attribute from the list of accumulate attributes as we will manage # these attributes seperately. if time_attribute in accumulate_attributes: accumulate_attributes.remove(time_attribute) if distance_attribute in accumulate_attributes: accumulate_attributes.remove(distance_attribute) else:
else: polygonType = "SIMPLE_POLYS" #Add an extra break so that we get better polygons without trimming if useExtraBreak: extraBreakValue = locale.str( round(converetedEndBreakValue * EXTRA_BREAK_VALUE_FACTOR, ROUND_PRECISION)) convertedBreakValueList.append(extraBreakValue) #Use only those restrictions that are supported by the network dataset. If the user supplied #restriction list contain un-supported restrictions, add a warning message. #Get the restrictions and accumulate attributes that are valid for the network dataset if restrictions: restrictions_to_use = nau.get_valid_attributes(descNDSAttributes, restrictions) else: restrictions_to_use = [] #Make a new service area layer saLayer = arcpy.na.MakeServiceAreaLayer( networkDataset, NA_LAYER, impedanceAttribute, travelDirection, " ".join(convertedBreakValueList), polygonType, polygonMerge, polygonNestingType, "NO_LINES", "OVERLAP", "NO_SPLIT", "", "", uturnPolicy, restrictions_to_use, trimPolygons, polygonTrimDistance, "NO_LINES_SOURCE_FIELDS", useHierarchy, arriveDepartTime).getOutput(0) saLayerExists = True saLayerSolverProps = arcpy.na.GetSolverProperties(saLayer) #Set the timeZoneUsage if timeOfDay is specified if arriveDepartTime: