Hi, I'm having problem with the syntax for field mappings, using Pro 2.5. I've tried:
PointBarriers = a point feature class
route = arcpy.nax.Route(NDLayerName)
pointFieldMappings = "BarrierType 0;CurbApproach 0;FullEdge 0"
route.load(arcpy.nax.RouteInputDataType.PointBarriers, PointBarriers,pointFieldMappings)
Thanks for help!
Solved! Go to Solution.
As described in the documentation for the Route solver object, you need to use an NAClassFieldMappings object, which is made up of NAClassFieldMap objects. That documentation contains several examples.
As described in the documentation for the Route solver object, you need to use an NAClassFieldMappings object, which is made up of NAClassFieldMap objects. That documentation contains several examples.
yes, thanks, I had seen this documentation but it wasn't entirely clear. Looking at it again I found my error when using it:
I had tried to use the mappedFieldname and got an error, but now see that the "Name" in the example is the field name
field_mappings_origins["Name"].defaultValue = "Origen"
which wasn't clear before. It still seems there should be a way to have a list rather than having to specify the value of the fields, one at a time. Or maybe I missed that in the docs.