Having problems setting up an OD cost matrix analysis in model builder

1330
2
07-18-2016 10:45 AM
JenniferMinnick
Occasional Contributor

So we do OD analyses all the time and it's time to make a model but I'm running into problems...

1) I need the user to input: Start time, origin points and destinations points so I set those three variables as parameters and it seems to work..SOLVED (mostly - issue with an additional parameter of output OD layer name)

2) But I need specific fields to be mapped (field mappings) for future steps.  I need to be able to set the "Name" of the Origin and Destination points.  Preferably programmatically - I want to model to fail if these fields don't exist. NOT SOLVED

3) As I'm trying to do this step by step before I run the whole thing I want to just make the OD cost matrix layer and add the origins and destinations and that is the end of this part of the model  but I have NO idea where this layer now lives and how to get it on my display.   I have "add to display" checked off for each step but nothing shows up in my Network Analyst (or regular) TOC.  I see the layers when I run the model in the drop down for selecting input locations but I can't see or delete...I think they are stored in the mxd but I can't access or view.

7-18-2016 1-40-58 PM.jpg

Doing my best to explain the steps I need to do.

Thanks...

0 Kudos
2 Replies
MelindaMorang
Esri Regular Contributor

Hello, Jennifer.

For Problem 2: You should be able to set up the field mapping the way you want if you feed your model a default input feature class.  So, go ahead and give it some origins and destinations as input, set up the field mapping the way you want it, but then leave the input origins and destinations as model parameters.  This way, you'll still be able to choose a different feature class as input.  That said, if the input has a field called Name, it will automatically map to the Name property in the Origins and Destinations anyway, so you don't need to set up anything special.  If you're trying to map a different field, then you do need to set up field mapping.  I'm not actually not sure if the tool will error out if the input doesn't have the appropriate fields.  You might need to use python instead of Model Builder if you want validation that complex.

For Problem 3: "Add to Display" only works when you run the model from the Model Builder canvas.  It's mostly a debugging tool.  If you want your output to be added to the map when you run the model as a tool, right-click the output and make it a parameter, just as you did for input parameters.  It becomes a derived output and will be added to the map.  I know, it's a little strange.

0 Kudos
JenniferMinnick
Occasional Contributor

Hi Melinda (we've actually met - a few years ago at a UC) -

I will try these things probably tomorrow and come back...thanks!

0 Kudos