【IT168技术文档】
Insert Feature是我们在开发过程中最容易遇到的问题,如果Insert的feature个数有限,那么你也许不关注Insert的速度问题。但是数据量比较大》500个的时候,你就会发现如果使用 IFeatureClass. CreateFeature的速度基本是无法忍受的。
其实ArcObjects中提供了一个接口,可以满足快速批量插入的要求。他就是:IFeatureBuffer
使用方法如下:
Set pFeatureBuffer = pFC.CreateFeatureBuffer Set pFeatureCursor = pFC.Insert(True) Set pFeature = pFeatureBuffer Set pPolyline = New Polyline 'Create 100 features using FeatureBuffer and insert into a feature cursor For i = 0 To 99 'Set the feature's shape TODO Set pFeature.Shape = pPolyline 'Insert the feature into the feature cursor q = pFeatureCursor.InsertFeature(pFeatureBuffer) Next i 'Flush the feature cursor to the database pFeatureCursor.Flush