Route Analysis using Modelbuilder - Field Mapping parameters for Add Locations not working

623
2
Jump to solution
08-10-2022 10:07 AM
RachelPasser_RFA
New Contributor II

I'm building a model to measure distances (miles) and accumulate drive time (minutes) between predetermined origin and destination points. I already have this workflow down manually, but want to turn it into a geoprocessing model since it's a routine task for work.

I'm using ArcGIS Pro 2.9 with the Network Analyst extension, and streetmap premium's Routing_ND for the network dataset.

At this time, the model is broken into 2 parts since the output of part 1 wasn't connecting to part 2 when they were 1 entire model.

Part 1 works:
part1_model.PNGpart1_geop2.PNG

Part 2 and its ability to successfully connect to Part 1 is where I'm looking for help.

Here is part 2 so far:
part2_model.PNGpart2_geop2.PNG

When I tried running the part 2 model as-is, it generated 1 route with 200 stops. I need 100 routes with 2 stops (correctly connecting the predetermined origins/destinations). When doing this manually, the Add Locations tool's field mappings are key to adding the origins and destinations correctly as Stops into the Route Analysis layer. They have a combo_ID in common that I need assigned to both the origin and destination RouteName in field mapping. Additionally, I use the combo_ID in the sort field to doubly make sure origins and destinations are being loaded in the same order. I also have a from_ID and to_ID I use as the 'Name' field mapping when adding locations for origins and destinations, to ensure both sets of stops have unique IDs as well.

In modelbuilder, I can apply those settings to the Add Locations tool, but when I turn Field Mappings into a parameter so it can be used as a geoprocessing model, the field mappings remain grayed out and cannot be specified. I imagine this is why I'm getting 1 route with 200 stops, I don't know how to parameterize the field mappings each time I add locations in modelbuilder. Any idea how to get that working?

Additionally, for part 2 there's no parameter to set impedance so I can specify Route measure distance in miles. I only see the Accumulate window. Where would impedance be?

I'm ok keeping this workflow as 2 separate models for the time being, but I'd also ideally want to successfully connect them as one model, but the origin and destination points generated in part 1 wouldn't turn into parameters either. Any suggestions on how to connect part 1 and part 2 into 1 geoprocessing model?

Thank you!

 

0 Kudos
1 Solution

Accepted Solutions
MelindaMorang
Esri Regular Contributor

Hi Rachel.  I'm not really surprised that this isn't working.  The Add Locations tool doesn't have access to the schema information about the output of Model 1, so it can't construct the field mapping reliably.  I'm not really sure how you could get this to work.  Maybe you could put all of it in one model, and if it was validated or run once, Add Locations might be able to figure it out.  But in general I think this strategy is pretty iffy, and I wouldn't recommend it.

If you can change your combo_ID fields to RouteName in advance, that might make it work because the field mapping will happen automatically.

Regarding the impedance attribute - that's included in the Travel Mode now.  If you don't like the defaults of the travel modes already included in your network dataset, you can make a new travel mode and use that.

If you're frustrated with the model workflow and just need an easy way to get costs for known origin-destination pairs, you can download and use a sample tool we have here: https://github.com/Esri/large-network-analysis-tools  This toolbox contains tools designed primarily for solving very large network analysis problems, but you could still use the known OD pair tool with a small problem.  It will probably serve your needs out of the box.

To use this tool, download the latest version using the Releases link on the far right:

MelindaMorang_0-1660155532779.png

You will want to use the "Solve Large Analysis With Known OD Pairs" tool.  The tool's documentation is included in the link above.

View solution in original post

2 Replies
MelindaMorang
Esri Regular Contributor

Hi Rachel.  I'm not really surprised that this isn't working.  The Add Locations tool doesn't have access to the schema information about the output of Model 1, so it can't construct the field mapping reliably.  I'm not really sure how you could get this to work.  Maybe you could put all of it in one model, and if it was validated or run once, Add Locations might be able to figure it out.  But in general I think this strategy is pretty iffy, and I wouldn't recommend it.

If you can change your combo_ID fields to RouteName in advance, that might make it work because the field mapping will happen automatically.

Regarding the impedance attribute - that's included in the Travel Mode now.  If you don't like the defaults of the travel modes already included in your network dataset, you can make a new travel mode and use that.

If you're frustrated with the model workflow and just need an easy way to get costs for known origin-destination pairs, you can download and use a sample tool we have here: https://github.com/Esri/large-network-analysis-tools  This toolbox contains tools designed primarily for solving very large network analysis problems, but you could still use the known OD pair tool with a small problem.  It will probably serve your needs out of the box.

To use this tool, download the latest version using the Releases link on the far right:

MelindaMorang_0-1660155532779.png

You will want to use the "Solve Large Analysis With Known OD Pairs" tool.  The tool's documentation is included in the link above.

RachelPasser_RFA
New Contributor II

Hi Melinda, first thank you for taking the time to provide an insightful response. Your explanation makes sense. I just tried the known OD Pairs tool and it worked with my data. Thank you for pointing me in the right direction (pun intended) - this is fantastic!

Perhaps I can continue to use the part 1 of my model for prepping the data, then use your known OD Pairs tool for the rest. Kudos!

0 Kudos