laptop and a wrench

漏洞

Running arcpy.management.SelectLayerByAttribute through multiple iterations, when the input is a feature class or table, results in each iteration being slower than the previous iteration.

上次发布: February 22, 2023 ArcGIS Pro
漏洞 ID 编号 BUG-000153589
已提交November 9, 2022
上次修改时间October 7, 2024
适用范围ArcGIS Pro
找到的版本3.0.2
操作系统Windows OS
操作系统版本10.0 64 Bit
状态As Designed

附加信息

Using the dataset instead of a layer as an input to the SelectBy tools is for convenience reasons. But it incurs some performance problems, as captured and explained in this issue. If performance is a concern, see the workaround. When a dataset is passed as an input to the SelectBy tools, the first step is to generate a unique layer name. The heuristic is to create a layer based on the input name and if the layer exists, add an incrementing numeric value. So if the input dataset is 'city.shp', the tool generates 'cityLayer' in the first loop. The second loop also generates 'cityLayer' but as this returns 'True' to the existence check, the name of the layer is renamed to 'cityLayer1'. The third loop hits two name collisions before settling on 'cityLayer2',  and so on. By the 100th iteration, we have 99 existence checks returning 'True', allowing to settle on 'cityLayer99'. The slowdown in the later parts of the iteration is due to this.

解决办法

Use arcpy.management.MakeFeatureLayer to create a feature layer to be used as an input for arcpy.management.SelectLayerByAttribute. Refer to the following ArcMap documentation for more information: https://desktop.arcgis.com/en/arcmap/latest/tools/data-management-toolbox/select-layer-by-attribute.htm

重现步骤

漏洞 ID: BUG-000153589

软件:

  • ArcGIS Pro

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

下载 Esri 支持应用程序

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

获取来自 ArcGIS 专家的帮助

联系技术支持部门

下载 Esri 支持应用程序

转至下载选项