AnsweredAssumed Answered

Barrier "" in "Line Barriers" has no associated network location information.

Question asked by sotriant on Sep 13, 2019
Latest reply on Sep 13, 2019 by sotriant

I am using ArcGis 10.4.1 and network analyst extension. I am facing an issue when loading barrier lines using arcpy. It appears that the network elements that have restrictions in network dataset attributes have no network location information.


If i load the line barriers using ArcMap and a New Route layer everything works ok, if i click "Use Geometry" in Location Position frame, whilst if i use the arcpy created layer if i click  "Use Geometry" in Location Position frame and if i add a new line barrier that is crossing an network element that has restriction i get error: Barrier "whatever" in "Line Barriers" has no associated network location information. If the line barrier doesnt cross elements with restrictions i get no error.


Obviously the arcpy created layer has a miconfiguration. Part of the code that i use:


## Create a new Route layer

outRouteResultObject =, outNALayerName, impedanceAttribute, "FIND_BEST_ORDER", ""+EndPoint+"", "", ["Minutes", "Length"], "ALLOW_DEAD_ENDS_AND_INTERSECTIONS_ONLY", RoadRules, "USE_HIERARCHY", "", "TRUE_LINES_WITH_MEASURES","")

##Get the layer object from the result object. The route layer can now be referenced using the layer object.

outNALayer = outRouteResultObject.getOutput(0)



##Get the names of all the sublayers within the route layer.

subLayerNames =



##Store the layer names that we will use later

stopsLayerName = subLayerNames["Stops"]
routesLayerName = subLayerNames["Routes"]

##set up field mapping. Map the "Group_ID" field from the input data to the RouteName property in the Stops sublayer

fieldMappingsStore =, stopsLayerName)
fieldMappingsStore["RouteName"].mappedFieldName = "Group_ID"
fieldMappingsStops =, stopsLayerName)
fieldMappingsStops["RouteName"].mappedFieldName = "Group_ID"
fieldMappingsStops["Attr_Minutes"].defaultValue = 2

##Add locations as Stops., stopsLayerName, inDepots, fieldMappingsStore, "300 meters", "OBJECTID", [["networkDataset_ND", "MIDDLE"], ["networkDataset_ND_Junctions", "NONE"]], "MATCH_TO_CLOSEST", "CLEAR", "NO_SNAP", "", "", ""), stopsLayerName, inOrders, fieldMappingsStops, "300 meters", "OBJECTID", [["networkDataset_ND", "SHAPE"], ["networkDataset_ND_Junctions", "NONE"]], "MATCH_TO_CLOSEST", "APPEND", "SNAP", "1", "EXCLUDE", searchQuery)

#Figure out the layer's impedance attribute

solver_props =
impedance = solver_props.impedance
pointBarriersLayerName = subLayerNames["PolylineBarriers"]# {u'Barriers': u'Point Barriers', u'Routes': u'Routes', u'PolylineBarriers': u'Line Barriers', u'Stops': u'Stops', u'PolygonBarriers': u'Polygon Barriers'} etc
fieldMappingsBR =, pointBarriersLayerName)
fieldMappingsBR["BarrierType"].defaultValue = 0 #if it is restriction otherwise 1
fieldMappingsBR["Attr_" + impedance].defaultValue = 1.4


#Load restrictions features, pointBarriersLayerName, Barriers_shp, fieldMappingsBR)


Can you spot the mistake