POST
|
BUG-000106281 about this issue is apparently fixed for Pro SDK at release 2.3, https://pro.arcgis.com/en/pro-app/get-started/release-notes.htm but I still cannot apply symbology from a layer file to a layer in my map through a script tool in Pro. I have tried both call methods: arcpy.management.ApplySymbologyFromLayer(target_layer, symbology_layer) arcpy.ApplySymbologyFromLayer_management(target_layer, symbology_layer) And I have tried .lyr and .lyrx I know it is a problem with Pro, because if I run the exact same script tool in ArcMap (10.3) it works properly. Any information or suggestions?
... View more
03-07-2019
11:47 PM
|
1
|
7
|
3108
|
POST
|
BUG-000106281 about this issue is apparently fixed for Pro SDK at release 2.3, https://pro.arcgis.com/en/pro-app/get-started/release-notes.htm but I still cannot apply symbology from a layer file to a layer in my map through a script tool in Pro. I have tried both call methods: arcpy.management.ApplySymbologyFromLayer(target_layer, symbology_layer) arcpy.ApplySymbologyFromLayer_management(target_layer, symbology_layer) And I have tried .lyr and .lyrx I know it is a problem with Pro, because if I run the exact same script tool in ArcMap (10.3) it works properly. Any information or suggestions?
... View more
03-07-2019
11:45 PM
|
1
|
2
|
1346
|
POST
|
BUG-000106281 about this issue is apparently fixed for Pro SDK at release 2.3, https://pro.arcgis.com/en/pro-app/get-started/release-notes.htm but I still cannot apply symbology from a layer file to a layer in my map through a script tool in Pro. I have tried both call methods: arcpy.management.ApplySymbologyFromLayer(target_layer, symbology_layer) arcpy.ApplySymbologyFromLayer_management(target_layer, symbology_layer) And I have tried .lyr and .lyrx I know it is a problem with Pro, because if I run the exact same script tool in ArcMap (10.3) it works properly. Any information or suggestions?
... View more
03-07-2019
11:43 PM
|
1
|
1
|
848
|
POST
|
The updateConnectionProperties solution did not work for me when running as a script. This workaround does: current_project = arcpy.mp.ArcGISProject("CURRENT")
current_map = current_project.listMaps()[0]
symbology_layer = SymbologyPath + '\\FLO_scaled_graduated_symbol.lyrx'
new_lyr_file = arcpy.mp.LayerFile(symbology_layer)
new_lyr = new_lyr_file.listLayers()[0]
old_lyr = current_map.listLayers(original_network)[0]
old_lyr_name = old_lyr.name
new_lyr.updateConnectionProperties(new_lyr.connectionProperties, old_lyr.connectionProperties)
new_lyr.name = old_lyr_name
new_lyr_file.save()
current_map.insertLayer(old_lyr, new_lyr_file)
current_map.removeLayer(old_lyr) However, I want to publish this tool and I cannot because as far as I can tell webtools cannot use "CURRENT". By the way these are the other methods I have tried, none of which work in Pro but work fine in ArcMap: 1. arcpy.ApplySymbologyFromLayer_management(inputLayer, symbologyLayer) 2. Using derived output (e.g. parameter 2): arcpy.SetParameterAsText(2, inputLayer) params = arcpy.GetParameterInfo() params[2].symbology = symbologyLayer 3. Using derived output and pointing to the symbology file when setting script tool parameters.
... View more
10-22-2018
04:47 PM
|
5
|
2
|
1347
|
POST
|
Can Geoprocessing.ExecuteToolAsync(...) be accessed with Python via arcpy?
... View more
10-22-2018
04:17 PM
|
0
|
0
|
848
|
POST
|
Here is a workaround for Python: current_project = arcpy.mp.ArcGISProject("CURRENT")
current_map = current_project.listMaps()[0]
symbology_layer = SymbologyPath + '\\FLO_scaled_graduated_symbol.lyrx'
new_lyr_file = arcpy.mp.LayerFile(symbology_layer)
new_lyr = new_lyr_file.listLayers()[0]
old_lyr = current_map.listLayers(original_network)[0]
old_lyr_name = old_lyr.name
new_lyr.updateConnectionProperties(new_lyr.connectionProperties, old_lyr.connectionProperties)
new_lyr.name = old_lyr_name
new_lyr_file.save()
current_map.insertLayer(old_lyr, new_lyr_file)
current_map.removeLayer(old_lyr)
... View more
10-22-2018
04:16 PM
|
0
|
1
|
848
|
Title | Kudos | Posted |
---|---|---|
1 | 03-07-2019 11:43 PM | |
1 | 03-07-2019 11:47 PM | |
1 | 03-07-2019 11:45 PM | |
5 | 10-22-2018 04:47 PM |
Online Status |
Offline
|
Date Last Visited |
02-05-2023
12:49 AM
|