AnsweredAssumed Answered

Route Layer Field Mappings

Question asked by sotriant on Jul 25, 2018
Latest reply on Jul 25, 2018 by MMorang-esristaff

I m using ArcGis 10.4.1 and network analyst extension where i create a Route Analysis layer.  The following code's part is used:

 

#add a depot as stop.

fieldMappingsStore = arcpy.na.NAClassFieldMappings(outNALayer, stopsLayerName)
fieldMappingsStore["RouteName"].mappedFieldName = "Group_ID" #correlates fields ie naStops attribute table with inStores attribute table

 

fig.1 stores attribute table

 

#add stops

fieldMappingsStops = arcpy.na.NAClassFieldMappings(outNALayer, stopsLayerName)
fieldMappingsStops["RouteName"].mappedFieldName = "Group_ID" #correlates fields ie naStops attribute table with inStores attribute table

 

fig.2 stops attribute table


 

#AddLocations_na
arcpy.na.AddLocations(outNALayer, stopsLayerName, inDepots, fieldMappingsStore,................)
arcpy.na.AddLocations(outNALayer, stopsLayerName, inOrders, fieldMappingsStops,.................)

 

Apparently something is wrong with the above approach because the route layer is solved i get the following, where we can see that the first location for RouteName 1012 has SourceOID =-1 .

 

fig.3 Route Analysis layer stops attribute table

 


 

I don want want to use VRP because it is slower. Do i have to change my approach and merge the two shapefiles(stores and stops) or i can still use the above approach?

 

 

Outcomes