问题描述
- ArcEngine中拷贝feature时候报错
-
public static void MyInsertFeature(IFeatureClass pFeatureClass IGeometry pGeometry) { IFeatureBuffer pFeatureBuffer=null; int typeFieldIndex = pFeatureClass.FindField(""Layer""); pFeatureBuffer = pFeatureClass.CreateFeatureBuffer(); IFeatureCursor insertCursor = pFeatureClass.Insert(true); pFeatureBuffer.set_Value(typeFieldIndexZBTZ""); pFeatureBuffer.Shape = pGeometry; insertCursor.InsertFeature(pFeatureBuffer); }
程序调试时,每次到 pFeatureBuffer.Shape = pGeometry;这里就报错“这个集合中找不到此项目。”,pGeometry明明不是null啊.求高手解答啊。困扰好久了。很郁闷。
解决方案
找到原因了!!!原来是数据类型不匹配,所以不能赋值。
在featureclass定义的时候应该加上geometryDefEdit.HasZ_2 = true;
不然无法将3d数据强行赋给2d的
时间: 2024-08-30 03:25:02