laptop and a wrench

漏洞

Error setting symbol template for the GraduatedSymbolsRenderer class from ArcPy in ArcGIS Pro.

上次发布: November 21, 2019 ArcGIS Pro
漏洞 ID 编号 BUG-000125730
已提交October 3, 2019
上次修改时间April 28, 2025
适用范围ArcGIS Pro
找到的版本2.4.1
状态Will Not Be Addressed

附加信息

After further investigation it was discovered that the layer being set from simple symbol to graduated colors did not have appropriate attributes to support this renderer. The same occurs in the UI and an error message appears stating the issue.

解决办法

Add a layer file (template) that has the renderer set for the point FC, then change its data source to your correct point FC, update the classificationField to refresh the stats for the new layer and remove the original, replaced layer.

 

 

p = arcpy.mp.ArcGISProject('current')

m = p.listMaps('Map')[0]

lyr1 = m.listLayers('SimplePtLayer')[0]

lyrFile = arcpy.mp.LayerFile(r"C:\Temp\GraduatedColors_Point.lyrx")

lyr2 = m.addLayer(lyrFile)[0]

lyr2.updateConnectionProperties(lyr2.connectionProperties, lyr1.connectionProperties)

sym = lyr2.symbology

sym.renderer.classificationField = 'Elevation' #resets field and stats

 

#Update symbol template - keep in mind lyrx could already have it.

symTemp = sym.renderer.symbolTemplate

symTemp.applySymbolFromGallery('Square 1')

sym.renderer.updateSymbolTemplate(symTemp)

 

#apply changes

lyr2.symbology = sym

 

#remove original layer

m.removeLayer(lyr1)

重现步骤

漏洞 ID: BUG-000125730

软件:

  • ArcGIS Pro

当漏洞状态发生变化时获得通知

下载 Esri 支持应用程序

发现关于本主题的更多内容

获取来自 ArcGIS 专家的帮助

联系技术支持部门

下载 Esri 支持应用程序

转至下载选项