POST
|
Not yet I'm afraid, but I'll keep trying to find a work around. I tried also first converting the fc to a layer using arcpy.MakeFeatureLayer_management before adding to the map with addLayer and then using arcpy.ApplySymbologyFromLayer_management but the same thing happened: script completes successfully without error but no visible change is made.
... View more
06-18-2018
03:41 PM
|
0
|
1
|
3087
|
POST
|
I'm trying it initially using only single symbol to match the symbology of the reference lyrx file so I didn't think the optional fields were required. Running it in immediate mode has the same effect as running it from the toolbox. Unfortunate that refreshActiveView no longer exists. Previously in the desktop version I would use arcpy.mapping.UpdateLayer to update symbology of fields added to the TOC but that option too seems to have disappeared with the upgrade to Pro...
... View more
06-14-2018
03:54 PM
|
0
|
3
|
3087
|
POST
|
Using an arcpy script run from a toolbox, I want to import a feature class from a geodatabase into an ArcPro map and then symbolise that layer based on a lyrx file stored on disk. Here is a simplified version: import arcpy, os
aprx = arcpy.mp.ArcGISProject('CURRENT')
m = aprx.listMaps('*')[0]
outputWorkspace = r"C:\Path\To\MyProject.gdb"
arcpy.env.workspace = outputWorkspace
out_fc = "fc_data"
out_fc_p = os.path.join(outputWorkspace, out_fc)
ref_lyrx = r"C:\Path\To\symbol_ref.lyrx"
m.addDataFromPath(out_fc_p)
out_fc_lyr = m.listLayers()[0]
arcpy.ApplySymbologyFromLayer_management(out_fc_lyr, ref_lyrx)
The script completes without error but no visible change is made to the symbology. Is this a bug? I've reviewed many similar questions but have been unable to resolve this.
... View more
06-13-2018
09:40 PM
|
1
|
27
|
9347
|
Title | Kudos | Posted |
---|---|---|
1 | 06-13-2018 09:40 PM |
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:24 AM
|