当前位置:网站首页>ArcEngine cannot find this item in this collection
ArcEngine cannot find this item in this collection
2022-04-22 14:26:00 【ShirmyMao】
arcengine This item cannot be found in this collection
Recently ArcEngine There are many problems in the development process “ This item cannot be found in this collection ” Error of , The cause is different every time , The solution is also different , Do the following sorting , If you encounter other situations and solutions later , It will be updated from time to time
1.Feature.Shape Geometric assignment error
reason :
- It may be a person with z No value z It's worth it
- It may also be caused by the inconsistency between the new geometry and the layer coordinate system , if z The processing method of value cannot solve , Then consider coordinate transformation to ensure that their coordinate system is one
z The solution to the value problem is as follows :
Method 1:
- Set... For geometric objects z value
public static IGeometryDef GetGeometryDef(IFeatureClass featureClass)
{
var fieldName = featureClass.ShapeFieldName;
var index = featureClass.FindField(fieldName);
return featureClass.Fields.Field[index].GeometryDef;
}
/// <summary>
/// Set... For geometric information z value
/// </summary>
/// <param name="geo"></param>
/// <param name="geometryDef"></param>
public static void SetZ(IGeometryDef geometryDef, ref IGeometry geo)
{
if (geometryDef.HasZ)
{
IZAware zAware = geo as IZAware;
zAware.ZAware = true;
switch (geo.GeometryType)
{
case esriGeometryType.esriGeometryPoint:
IPoint point = geo as IPoint;
point.Z = point.Z is double.NaN ? 0 : point.Z;
geo = point;
break;
case esriGeometryType.esriGeometryMultipoint:
IPointCollection collection = geo as IPointCollection;
for (int i = 0; i < collection.PointCount; i++)
{
var p = collection.Point[i];
p.Z = 0;
collection.UpdatePoint(i, p);
}
geo = collection as IMultipoint;
break;
default:
IZ iz = geo as IZ;
if (iz != null)
iz.SetConstantZ(0);
break;
}
}
}
Method 2:
- Remove layer's z value
IGeometryDefEdit geoDefEdit = geometryDef as IGeometryDefEdit;
geoDefEdit.HasZ_2 = false;
2.Feature.Store Report errors
reason :
var cursor=layer.Search(filter,true)
Set up recycling The attribute is true, If only query attribute information , No problem , But if you modify the elements , Because it is automatically recycled, it will report the error that this item cannot be found in the collection , Change it to false that will do , As shown below :

3.layer.FeatureClass.CreateFeature() Report the error
In general, this is a data problem , You will find that even directly in arcmap This error will also be reported when creating features in , At this point, the solution is to right-click the layer —— data —— Derived data , Edit again and you will find that there is no such problem . This may be what happens in the data production process bug

版权声明
本文为[ShirmyMao]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204221421352550.html
边栏推荐
- C language sanziqi, summed up a perfect SQL learning note in 22 days
- With Feixiang, this task management artifact, the work is more convenient and efficient
- Codeforces Round #782 (Div. 2) D. Reverse Sort Sum
- Cloudera Manager HA模式搭建
- String inversion exercises 344, 541, 557, 151
- What happens when you run the NPM install command?
- logcat的使用
- leetcode:215. 数组中的第K个最大元素
- Advanced multithreading
- Binary Tree练习二叉树遍历递归257、100、222、101、226、437、563、617、572、543、|687
猜你喜欢

@Resource与构造函数踩坑

字节跳动的面试分享,为了拿下这个offer鬼知道我经历了什么
Android 92022-2022 byte beating Android interview real question analysis

Mariadb互为主从(双主模式)配置

万元礼品奖池!玩转「Lighthouse」有奖征文来袭

Series interpretation of smc-r (II): smc-r communication technology integrating TCP and RDMA

Arcpy development environment configuration

Completion of minmao e-commerce in 10 days - Implementation of user module (2nd day)

Advanced multithreading

Detailed explanation of kubernetes (VI) -- pod object deployment and Application
随机推荐
gradle 引用平级项目
Software Architect - Creative Pattern - singleton pattern - prototype pattern - Factory Method Pattern - Abstract Factory Pattern - builder pattern
2. Flddler response shows the solution to the problem of garbled code
ArcEngine符号相关
Methods of safety testing
LeetCode刷题(04)
图 钥匙和房间
HashTable哈希表与索引1、599、219
贪心 动规||跳跃游戏45、55
Mariadb互为主从(双主模式)配置
Codeforces Round #782 (Div. 2) D. Reverse Sort Sum
数据库SQL实战全解
error unable to access jarfile 解决方案
华为云媒体査勇:华为云在视频AI转码领域的技术实践
Hashtable hash table and index 1, 599, 219
代码覆盖率之 sonar
深入理解Condition
CorelDRAW插件-CPG插件开发-环境搭建-VS2017-TLB文件-CDR插件
Hashtable hash table practice finding, inserting, deleting 217, 349, 202, 287, 290, 532, 205, 128
Binarytree practice binary tree serialization and deserialization 606, 331, 652, 297