AnsweredAssumed Answered

Route "Name" field

Question asked by ekmandal on Mar 25, 2016
Latest reply on Mar 26, 2016 by ekmandal

Hi All,

I am trying to Solve best routes between each OD (origin-destination) pair. I want  the route "Name" field to be populated by the value in the field "PRMT_ID" of the origins. PRMT_ID field is in the destination point feature also.I am using python code as below: The route solution works fine, except that the "Name" field of the route only says Location 1-Location 2. It doesn't populate it with the value in the "PRMT_ID" field as I was expecting. I wonder if anyone can advise on how to make the route layer show the "PRMT_ID" value instead of saying generic Location 1-Location 2

Appreciate any help!

 

I wrote the code referring to the MakeRouteLayer example 4.

and below are a few lines

Make Route Layer—Help | ArcGIS for Desktop

(ArcGIS 10.3.1)

fieldMappings = arcpy.na.NAClassFieldMappings(outNALayer, stopsLayerName)

fieldMappings["Name"].mappedFieldName = "PRMT_ID"

arcpy.na.AddLocations(outNALayer, stopsLayerName, inOrigins, fieldMappings,"")

arcpy.na.AddLocations(outNALayer, stopsLayerName, inDestinations, fieldMappings,"")

arcpy.na.Solve(outNALayer)

Outcomes