problem with Field Mapping syntax in Pro 2.5

381
2
Jump to solution
08-20-2020 12:22 PM
jacquelinewillan1
New Contributor III

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!

0 Kudos
1 Solution

Accepted Solutions
MelindaMorang
Esri Regular Contributor

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.

View solution in original post

0 Kudos
2 Replies
MelindaMorang
Esri Regular Contributor

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.

0 Kudos
jacquelinewillan1
New Contributor III

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.

0 Kudos