Solve OD cost matrix ??? Compute new field in « Line » objects table

2925
4
09-21-2011 06:38 AM
Highlighted
New Contributor II
Dear all,
I am running several OD cost matrix analysis. Working with the "Lines" table output, I am wondering if it???s possible to add (or compute) a field during the solve process. By default the field names of the Lines table are:

ObjectID/Shape/Name/OriginID/DestinationID/DestinationRank/Total_Length

For example is it possible to have a Name2 field that would work exactly the same as the Name field ? Or another field like OriginID that contains a values from the Origins table ?

Here???s my situation :
Origins and destinations are addresses (point features) of my city and have the same table structure :

ObjectID/Shape/StreetName/StreetNum/AddressID/NeighbourID
« AddressID » is a unique address identifier. « NeighbourID » identify the zone (neighbourhood) in which the address point is located. My goal is to get the following « Lines » table after solving the OD cost matrix :

ObjectID/Shape/Name/OriginID/DestinationID/DestinationRank/Total_Length/OriginNeighbourID/DestinationNeighbourID/Name2 (see screenshot attached)

The only thing I found is the "add field to analysis layer" tool, but as far as I know it only adds field to Origins, Destinations, Barriers prior to the analysis.

Any idea ?
Best regards,
Theo
Tags (2)
Reply
0 Kudos
4 Replies
Highlighted
Esri Regular Contributor
Basically Add the required fields to the Lines table, set up a Join to Origins (or Destination) table and Calc the vaues over.

You can add a Fields like AddressID and NeighbourID to the Origins table when you First create the OD layer.
Then when you do a Load Locations to load the Origins, you can MAP over the AddressID field from your Point feature class over to the newly added AddressID field (same for the NeighbourID) and now these values will be loaded over to your Origins table. After the solve, add the same fields to your Lines and set up a join based on the OriginID on Lines and ObjectID on the Origins table. And then use the field calculator to populate the values for AddressID.

You can read more on load locations here:http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/in_ArcMap/00470000003t000000/

Jay Sandhu
Reply
0 Kudos
Highlighted
Occasional Contributor III

Maybe I'm missing something here, but this seems way too unnecessarily difficult.  I was able to use the "add field to analysis layer" tool to add a field that did show up in my output service area lines, but it was always completely null when trying several different input options in the tool.  I eventually used "Select Data" tool with the 'facilities' option and then copy features to export a point feature class with the "STOP_ID" field in my input point layer.  Then I joined the output lines using Facilities.ObjectID = ServiceAreaLines.FacilityID.  Then I used "Calculate Field" to finally get the STOP_ID onto the output service areas lines. 

Why can't users just specify a series of fields in the "Add locations" tool and those fields be present (and populated) in all of the Network Analyst output!?!?!?

I think the documentation on this issue needs to be more fleshed out.  Sample geoprocessing models would also be helpful.  

Highlighted
New Contributor II
Dear Jay,

Thanks a lot for your answer that helped me enough to succeed  😄
I've attached 2 screenshots of my OD Cost Matrix layer in Modelbuilder thinking that they might be helpfull to somebody.

Best regards,
Theo
Reply
0 Kudos
Highlighted
New Contributor III
Is there a way to do this with python geoprocessing?  This is probably just a stupid problem, but I can't seem to figure out how to work with the Lines sublayer in python after I create it.

I want to:
- Create fields in the Lines layer correspinding to my unique stop ids that were in the origin and destination sublayers
- Export the Lines layer attributes table, including the new fields with the stop id, to a csv

I've figured out how to calculate the OD Matrix in python, but after it's created, I can't figure out how to do anything with it in python, although I'm able to manipulate it by hand from ArcMap.  I'm really stuck.
Reply
0 Kudos