Select to view content in your preferred language

Error 000732 with Route analysis

437
2
Jump to solution
06-07-2022 07:19 AM
Arcnoob
Emerging Contributor

I'm new to ArcGIS and ArcPy, but not at all new to programming/computer science. I've been struggling with learning some of these concepts, as there don't seem to be many resources out there to help break them down. A thing I'm struggling with currently is that I'm trying to transfer a Route Analysis workflow from ArcGIS Pro into a python script. I got some advice to copy python snippets from the geoprocessing results log, and this helped me to find methods much more easily. However, copying the snippets and using them outside of ArcGIS doesn't work right away.

 

Here's the code:

import arcpy

arcpy.env.overwriteOutput = True

arcpy.management.FeatureVerticesToPoints(r"C:\Users\[]\Documents\[]\Arc Projects\Rail API\Rail Shapefiles\CSXTransportationOffline.shp", 
    r"C:\Users\[]\Documents\[]\Arc Projects\[]-Testing\MyProject\MyProject.gdb\CSXTransportationOffline_Point", "ALL")
arcpy.na.MakeRouteAnalysisLayer("https://www.arcgis.com/", "Route", "Driving Time", "USE_CURRENT_ORDER", 
    None, "LOCAL_TIME_AT_LOCATIONS", "ALONG_NETWORK", None, "DIRECTIONS", "LOCAL_TIME_AT_LOCATIONS", "SKIP")
arcpy.na.AddLocations("Route", "Stops", r'C:\Users\[]\Documents\[]\Arc Projects\[]-Testing\MyProject.gdb\CSXTransportationOffline_Point', 
    "Name # #;RouteName # #;Sequence # #;TimeWindowStart # #;TimeWindowEnd # #;LocationType # 0;CurbApproach # 0;Attr_Minutes # 0;Attr_TravelTime # 0;Attr_Miles # 0;Attr_Kilometers # 0;Attr_TimeAt1KPH # 0;Attr_WalkTime # 0;Attr_TruckMinutes # 0;Attr_TruckTravelTime # 0", 
    "5000 Meters", "OBJECTID", None, "MATCH_TO_CLOSEST", "APPEND", "NO_SNAP", "5 Meters", "EXCLUDE", None)
arcpy.na.Solve("Route", "SKIP", "TERMINATE", None, '')

 

The '[]' simply replaces identifying information, aside from that my file paths are unaltered (and correct). I've already done some tweaking, the FeatureVerticesToPoints method didn't work initially and needed the parameters fixed. Now the AddLocations method isn't working, returning the following error:

ERROR 000732: Input Locations: Dataset C:\Users\[]\Documents\[]\Arc Projects\[]-Testing\MyProject.gdb\CSXTransportationOffline_Point does not exist or is not supported

To me, this indicates that it can't find the Points feature layer that I created in the FeatureVerticesToPoints method. I'm guessing that this is because the feature layer is not actually a file, but rather just an element in the MyProject.gdb file, and thus, is not findable by the Windows filesystem. However, I've asked this question in a few other places already, and people have indicated to me that it should work as is. Unfortunately, it doesn't work as is, and I've been stuck on this error for several days now. I'm hoping someone here can help me with this.

On a slightly related note, if anyone knows of any guides or resources besides the official documentation that I can look through to help me solve problems on my own in the future, that'd also be appreciated.

0 Kudos
1 Solution

Accepted Solutions
AlfredBaldenweck
MVP Regular Contributor

Out of curiosity, what happens if you set arcpy.management.FeatureVerticesToPoints() as a variable?

I think I was having a similar problem on another project I was working on and that fixed it.

eg. (Changes on lines 5 and 9)

 import arcpy

arcpy.env.overwriteOutput = True

pointsT =arcpy.management.FeatureVerticesToPoints(r"C:\Users\[]\Documents\[]\Arc Projects\Rail API\Rail Shapefiles\CSXTransportationOffline.shp", 
    r"C:\Users\[]\Documents\[]\Arc Projects\[]-Testing\MyProject\MyProject.gdb\CSXTransportationOffline_Point", "ALL")
arcpy.na.MakeRouteAnalysisLayer("https://www.arcgis.com/", "Route", "Driving Time", "USE_CURRENT_ORDER", 
    None, "LOCAL_TIME_AT_LOCATIONS", "ALONG_NETWORK", None, "DIRECTIONS", "LOCAL_TIME_AT_LOCATIONS", "SKIP")
arcpy.na.AddLocations("Route", "Stops", pointsT', 
    "Name # #;RouteName # #;Sequence # #;TimeWindowStart # #;TimeWindowEnd # #;LocationType # 0;CurbApproach # 0;Attr_Minutes # 0;Attr_TravelTime # 0;Attr_Miles # 0;Attr_Kilometers # 0;Attr_TimeAt1KPH # 0;Attr_WalkTime # 0;Attr_TruckMinutes # 0;Attr_TruckTravelTime # 0", 
    "5000 Meters", "OBJECTID", None, "MATCH_TO_CLOSEST", "APPEND", "NO_SNAP", "5 Meters", "EXCLUDE", None)
arcpy.na.Solve("Route", "SKIP", "TERMINATE", None, '')

 Barring that, are you able to confirm it's actually creating that points feature class?

What you've read is correct; feature classes have a normal file address, with the GDB and feature dataset (if applicable) treated as folders in the directory.

 

View solution in original post

2 Replies
AlfredBaldenweck
MVP Regular Contributor

Out of curiosity, what happens if you set arcpy.management.FeatureVerticesToPoints() as a variable?

I think I was having a similar problem on another project I was working on and that fixed it.

eg. (Changes on lines 5 and 9)

 import arcpy

arcpy.env.overwriteOutput = True

pointsT =arcpy.management.FeatureVerticesToPoints(r"C:\Users\[]\Documents\[]\Arc Projects\Rail API\Rail Shapefiles\CSXTransportationOffline.shp", 
    r"C:\Users\[]\Documents\[]\Arc Projects\[]-Testing\MyProject\MyProject.gdb\CSXTransportationOffline_Point", "ALL")
arcpy.na.MakeRouteAnalysisLayer("https://www.arcgis.com/", "Route", "Driving Time", "USE_CURRENT_ORDER", 
    None, "LOCAL_TIME_AT_LOCATIONS", "ALONG_NETWORK", None, "DIRECTIONS", "LOCAL_TIME_AT_LOCATIONS", "SKIP")
arcpy.na.AddLocations("Route", "Stops", pointsT', 
    "Name # #;RouteName # #;Sequence # #;TimeWindowStart # #;TimeWindowEnd # #;LocationType # 0;CurbApproach # 0;Attr_Minutes # 0;Attr_TravelTime # 0;Attr_Miles # 0;Attr_Kilometers # 0;Attr_TimeAt1KPH # 0;Attr_WalkTime # 0;Attr_TruckMinutes # 0;Attr_TruckTravelTime # 0", 
    "5000 Meters", "OBJECTID", None, "MATCH_TO_CLOSEST", "APPEND", "NO_SNAP", "5 Meters", "EXCLUDE", None)
arcpy.na.Solve("Route", "SKIP", "TERMINATE", None, '')

 Barring that, are you able to confirm it's actually creating that points feature class?

What you've read is correct; feature classes have a normal file address, with the GDB and feature dataset (if applicable) treated as folders in the directory.

 

Arcnoob
Emerging Contributor

Wow, nearly a week of asking for advice and no one has said that yet lol. I knew it was something simple, but everyone was basically just saying that there wasn't a problem with my code.

 

I can confirm that it was "working" before (as in, the Point feature layer showed up in my ArcGIS gui after running it in VS Code). Now I'm stuck on the Solve having a limit of 10,000 stops though, do you know how to change that limit?

0 Kudos