【AE】大数据点文件读取生成SHP文件时使用IFeatureBuffer快速提高读取效率

Creating features

http://help.arcgis.com/en/sdk/10.0/arcobjects_net/conceptualhelp/index.html#/Creating_features/00010000049v000000/

#region 创建要素

            int featCount = 0;
            IFeatureClass pFeatClass = pFeatLayer.FeatureClass;
       IFeatureCursor pFeatureCursor = pFeatClass.Insert(true);

            foreach (var id_car in m_dicCar_Obj)
            {
                foreach (var trace in id_car.Value.TraceList)
                {
                    IFeatureBuffer pFeatureBuffer = pFeatClass.CreateFeatureBuffer();
                   
                    IPoint pPoint = new ESRI.ArcGIS.Geometry.Point();
                    pPoint.X = trace._cp.Lng;
                    pPoint.Y = trace._cp.Lat;

                    pFeatureBuffer.Shape = pPoint;
                    pFeatureBuffer.set_Value(pFeatureBuffer.Fields.FindField("车辆识别码"), id_car.Key);
                    pFeatureBuffer.set_Value(pFeatureBuffer.Fields.FindField("GPS时间"), trace.GPSTime);
                    pFeatureBuffer.set_Value(pFeatureBuffer.Fields.FindField("经度"), trace._cp.Lng);
                    pFeatureBuffer.set_Value(pFeatureBuffer.Fields.FindField("纬度"), trace._cp.Lat);
                    pFeatureBuffer.set_Value(pFeatureBuffer.Fields.FindField("方向"), trace.GPSDirection);
                    pFeatureBuffer.set_Value(pFeatureBuffer.Fields.FindField("里程仪速"), trace.GPSSpeed);
                    pFeatureCursor.InsertFeature(pFeatureBuffer);
                    featCount++;
                }

            }

            pFeatureCursor.Flush();
            System.Runtime.InteropServices.Marshal.ReleaseComObject(pFeatureCursor);

            #endregion

猜你喜欢

转载自blog.csdn.net/hellfire2007/article/details/76644674