Select to view content in your preferred language

Add Trace Locations - Error in Portal with custom GP

73
2
Jump to solution
yesterday
CeciliaAtos
New Contributor

I’m running an isolation trace on a Utility Network through a geoprocessing tool.
In one of the steps, I’m using Add Trace Locations with the Load Selected Features option.

I can successfully run the geoprocessing tool in ArcGIS Pro, but when I publish it and run it through the Portal, I get the following error:

ERROR 000228: Cannot open the dataset.
Failed to execute (AddTraceLocations).

Here’s the relevant part of my code:

arcpy.un.AddTraceLocations(
    in_utility_network="https://myportal/server/rest/services/Agua/Agua/FeatureServer/8",
    out_feature_class=temp_starting,
    load_selected_features="LOAD_SELECTED_FEATURES",
    clear_trace_locations="CLEAR_LOCATIONS",
    trace_locations=None,
    filter_barrier="TRAVERSABILITY_BARRIER"
)

 

My temp_starting variable is a feature class created before in the scratch_gdb, using the same schema as UN_Temp_Starting_Points.

Does anyone know if there are any behavioral differences for this tool when running in ArcGIS Pro versus in a Portal environment?

0 Kudos
1 Solution

Accepted Solutions
gis_KIWI4
Frequent Contributor

@CeciliaAtos  - I think the issue here is the "load_selected" parameter. my understanding is that this will not work in the geoprocessing tool like it does on ArcGIS pro. 

You could use the arcpy.management.CopyFeature to create a feature class in the scratch gdb and then format it in the schema of the UN_Temp_Starting_Points.

Then load the starting points using the "trace_locations" parameter in Add Trace Locations or you can directly supply these to the Trace function.

This article has some more info - https://pro.arcgis.com/en/pro-app/3.3/tool-reference/utility-networks/add-trace-locations.htm#:~:tex....

import arcpy

# Set the outputZFlag environment to Enabled
arcpy.env.outputZFlag = "Enabled"

# AddTraceLocations
arcpy.un.AddTraceLocations(r"http://landbase.mydomain.com/server/rest/services/NapervilleElectric/FeatureServer/9", 
                           r"C:\Project\MyUNProject.gdb\TraceLocations",
                           "DO_NOT_LOAD_SELECTED_FEATURES",
                           "KEEP_LOCATIONS",
                           "'Circuit Breaker' {DDB0765D-860A-4054-908D-9360E1A32F74} '(3/Load)' #";"'ElecDist Line' {67C0534B-A80D-4E5F-8926-5FB5F887A5F2} # 0.25","TRAVERSABILITY_BARRIER")

 

View solution in original post

2 Replies
gis_KIWI4
Frequent Contributor

@CeciliaAtos  - I think the issue here is the "load_selected" parameter. my understanding is that this will not work in the geoprocessing tool like it does on ArcGIS pro. 

You could use the arcpy.management.CopyFeature to create a feature class in the scratch gdb and then format it in the schema of the UN_Temp_Starting_Points.

Then load the starting points using the "trace_locations" parameter in Add Trace Locations or you can directly supply these to the Trace function.

This article has some more info - https://pro.arcgis.com/en/pro-app/3.3/tool-reference/utility-networks/add-trace-locations.htm#:~:tex....

import arcpy

# Set the outputZFlag environment to Enabled
arcpy.env.outputZFlag = "Enabled"

# AddTraceLocations
arcpy.un.AddTraceLocations(r"http://landbase.mydomain.com/server/rest/services/NapervilleElectric/FeatureServer/9", 
                           r"C:\Project\MyUNProject.gdb\TraceLocations",
                           "DO_NOT_LOAD_SELECTED_FEATURES",
                           "KEEP_LOCATIONS",
                           "'Circuit Breaker' {DDB0765D-860A-4054-908D-9360E1A32F74} '(3/Load)' #";"'ElecDist Line' {67C0534B-A80D-4E5F-8926-5FB5F887A5F2} # 0.25","TRAVERSABILITY_BARRIER")

 

RobertKrisher
Esri Regular Contributor

@gis_KIWI4 is correct, when running that GP tool in a server context, it doesn't have access to the map that the user has open, so it has no way of knowing what is selected. The solution to the problem is to populate the trace_location parameter with the information for the locations/features you want to use as barriers.

0 Kudos