private IFeatureClass insertFeature_one( IFeatureClass fclass, IFeature feature){
try {
IFeatureBuffer pFeatBuf = fclass.createFeatureBuffer();
IFeature pFeat = (IFeature) pFeatBuf;
pFeat.setShapeByRef(feature.getShape());
IFeatureCursor pFeatCur = fclass.IFeatureClass_insert(true);
pFeatCur.insertFeature(pFeatBuf);
pFeatCur.flush();
} catch (AutomationException e) {
e.printStackTrace();
} catch (IOException e){
e.printStackTrace();
}
return fclass;
}
private IFeatureClass insertFeature_second(IFeatureClass fclass, IFeature feature){
try {
IFeature pFeature = fclass.createFeature();
pFeature.setShapeByRef(feature.getShape());
pFeature.store();
} catch (AutomationException e) {
e.printStackTrace();
} catch (IOException e){
e.printStackTrace();
}
return fclass;
}
private IFeatureClass insertFeatures( IFeatureClass fclass, List<IFeature> features){
try {
IFeatureBuffer pFeatBuf = null;
IFeatureCursor pFeatCur = null;
for(int i=0; i<features.size(); i++){
pFeatBuf = fclass.createFeatureBuffer();
pFeatCur = fclass.IFeatureClass_insert(true);
IFeature pFeat = (IFeature) pFeatBuf;
pFeat.setShapeByRef(features.get(i).getShape());
pFeatCur.insertFeature(pFeatBuf);
if(i/100 == 0){
pFeatCur.flush();
}
}
pFeatCur.flush();
} catch (AutomationException e) {
e.printStackTrace();
} catch (IOException e){
e.printStackTrace();
}
return fclass;
}
insertFeatureClass的三种方式
最新推荐文章于 2020-04-26 18:46:34 发布
本文提供了一个使用ArcGIS API进行要素批量插入的示例代码。通过三种不同方法展示了如何将带有几何形状的要素插入到指定的要素类中,并讨论了在处理大量数据时的性能考虑。
2617

被折叠的 条评论
为什么被折叠?



