当前位置:网站首页>arcengine 这个集合中找不到此项目
arcengine 这个集合中找不到此项目
2022-04-22 14:22:00 【ShirmyMao】
arcengine 这个集合中找不到此项目
近期在ArcEngine开发过程中碰到很多“这个集合中找不到此项目”的错误,每次引发的原因都不一样,解决方案也有所不同,特做以下整理,若之后遇到其它情况和解决方案,将会不定时更新
1.Feature.Shape 几何赋值报错
原因:
- 可能是一个有z值一个没有z值引起的
- 也可能是新几何与图层坐标系不一致导致的,若z值的处理方法解决不了,则考虑坐标转换确保他们坐标系统一
z值问题解决方案如下:
方法1:
- 给几何对象设置z值
public static IGeometryDef GetGeometryDef(IFeatureClass featureClass)
{
var fieldName = featureClass.ShapeFieldName;
var index = featureClass.FindField(fieldName);
return featureClass.Fields.Field[index].GeometryDef;
}
/// <summary>
/// 给几何信息设置z值
/// </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;
}
}
}
方法2:
- 去除图层的z值
IGeometryDefEdit geoDefEdit = geometryDef as IGeometryDefEdit;
geoDefEdit.HasZ_2 = false;
2.Feature.Store报错
原因:
var cursor=layer.Search(filter,true)
设置了recycling属性为true,若只是查询属性信息,没有问题,但是若是修改要素,由于被自动回收会报集合中找不到此项目的错误,改为false即可,如下所示:

3.layer.FeatureClass.CreateFeature()报该错误
一般这种情况是数据问题,你会发现即使直接在arcmap中创建要素也会报该错误,此时解决方案是图层右键——数据——导出数据,再次编辑你会发现没有该问题了。这可能是数据生产过程有什么bug

版权声明
本文为[ShirmyMao]所创,转载请带上原文链接,感谢
https://blog.csdn.net/qq_36047595/article/details/117654691
边栏推荐
- 阻塞队列-
- 双指针||有序数组去重 排序链表移除元素 26、27、83
- Bitmap bloomfilter BitSet details
- shell入门使用
- Double pointer fast and slow pointer 𞓜 happy number, search repetition number 202, 287, | 141, 142, 143, 234, 457
- Cloudera Manager HA模式搭建
- Redis batch delete data (wildcard)
- 深入理解Condition
- Double pointer in the same direction, double pointer, sliding window 3, 594, |27, 26, 80, 83, 82, 611, 187, 643, 674, 209, 438, 567, 424, 76, 30
- 2D conversion (move: translate, rotate: rotate, scale: scale, 2D conversion synthesis)
猜你喜欢

Basic use and internal implementation principle of handerthread

ArcEngine符号相关

Multithreading primary
20 required questions for 25K + Android Engineer Interview and Netease Android interview

Eight strange facts about semiconductors

Get the sum of a value in each item object in the array (use of reduce)

北斗gps卫星时间同步装置(卫星时钟)在广电系统的应用

有了飞项这款任务管理神器,工作更便捷高效

With Feixiang, this task management artifact, the work is more convenient and efficient

深入剖析volatile原理
随机推荐
TIANTI race - l2-002 linked list weight removal (25 points)
Figure keys and rooms
Binary tree practice binary tree traversal recursion 257, 100, 222, 101, 226, 437, 563, 617, 572, 543, |687
LeetCode_ 63 different paths II
深入剖析volatile原理
C语言的三子棋,用22天总结了一份完美的SQL学习笔记
博睿数据携手F5共同构建金融科技从代码到用户的全数据链DNA
logcat的使用
Codeforces Round #782 (Div. 2) D. Reverse Sort Sum
BinaryTree练习 从前序与中序、中序与后序遍历序列构造二叉树||重构二叉树654、105、106
2020 popular whole network series: This is a very suitable Android advanced - interview key and difficult data notes for collection and collection! Continuously update the high-quality interview links
系列解读 SMC-R (二):融合 TCP 与 RDMA 的 SMC-R 通信 | 龙蜥技术
leetcode:215. 数组中的第K个最大元素
redis的理解
每日一题——三国游戏(对角矩阵)
shell入门使用
Apache iotdb's UDF source code analysis (1)
Blocking queue-
Compared with redis, memcached
字节跳动的面试分享,为了拿下这个offer鬼知道我经历了什么