Using Pro 2.5, command Make Route Analysis Layer - how to change name of feature dataset

468
5
08-06-2020 04:33 AM
jacquelinewillan1
New Contributor III

When I run Make Route Analysis Layer, I specify layer name and the layer created has that name - however the feature dataset that is created is called Route1 - how can I specify the name of the feature dataset (that is the source of the layer)?

0 Kudos
5 Replies
MelindaMorang
Esri Regular Contributor

Can you clarify your workflow?  Are you doing this in python?  What do you intend to do with the feature dataset (this may help me to answer in a way that is more useful to you)?

0 Kudos
jacquelinewillan1
New Contributor III

I am using python with the legacy arcpy.na command. I have users that want to specify the name of a route, and to have the route (or at least the route line feature) saved to that name within a gdb for later comparison to other routes. I see that by changing the workspace to the gdb, then the feature dataset which contains the source files for the route, is written to that gdb. However, the feature dataset that is created is named Route1 (or if that exists, then Route2, etc). I am using python with the command, but have also tried the command 'Make Route Analysis Layer' manually and get the same result. I tried to rename the feature dataset and use 'updateConnectionProperties' to change the source of the Route layer to the new name, but the source didn't change. Alternatively, I just started looking at the new arcpy.nax module, but it requires a 'travel mode' to make a route from a network dataset. When I tried to create a 'travel mode' by looking at the properties of the network dataset, selecting travel mode - New, changing the mode name, and then clicking 'OK', the travel mode was not saved - is there another way to create and save a travel mode? I really appreciate your help - thanks!

0 Kudos
MelindaMorang
Esri Regular Contributor

Okay, no problem.  I will answer your question about how to get the path to the Routes sublayer in this thread, and I'll answer your travel mode question on your other post.

From what you've said, you don't actually need the feature dataset path specifically.  You just need to retrieve the Routes sublayer of the Route layer and save it out to another feature class, right?

Check out the last code sample (called "MakeRouteAnalysisLayer example 4") on this documentation page:

Make Route Analysis Layer (Network Analyst)—ArcGIS Pro | Documentation 

I think that demonstrates exactly what you're trying to do. Essentially you need to use the .listLayers() command on the Route layer object to retrieve the Routes sublayer object, and you can use that as input to other geoprocessing tools, like CopyFeatures.

0 Kudos
jacquelinewillan1
New Contributor III

This is helpful, but I want to keep the route layer that is created, so that a user can then add barriers later if they want to compare possible route solutions. In order to do that, unless I'm mistaken, the route layer must point to a feature dataset, as Pro doesn't allow the route to an in-memory workspace which means the user has this feature dataset in their gdb and they don't know which route layer uses that feature dataset. If they don't know what the feature datasets Route1, Route2 , etc, are, then it is confusing as to which ones can be deleted when they decide not to keep a particular route. Yes, they could look at the source of the Route Layer, but for my users it would be more intuitive if the feature dataset had the same name. However, since you answered my travel mode question on the other post, I will investigate the arpy.nax module further to see if that will work for me instead.  Thanks!

0 Kudos
MelindaMorang
Esri Regular Contributor

Yeah, the layer itself exists only in the map, but its data is sitting in the geodatabase grouped into a feature dataset.  You can save the layer as a layer file using the Save To Layer File tool if you want to re-use it later, but you have to be careful to keep the analysis database and the network dataset with the same relative paths to the .lyrx file or else it will be broken.

You can also save the layer as a layer package.  Both the analysis data (the stuff from the feature dataset) and the network dataset will be packaged into the layer package.  This guarantees that you'll have everything, but you risk proliferating copies of your network dataset.  That's not good if your network is large.

0 Kudos