Exemplo n.º 1
0
        static void DuplicateShapeElimination()
        {
            IFeatureSet      centroid = FeatureSet.Open(@"D:\OneDrive\2017研究生毕业设计\数据\项目用数据\newCentroid.shp");
            HashSet <string> set      = new HashSet <string>();
            List <int>       index    = new List <int>(5);

            foreach (var item in centroid.Features)
            {
                string name = item.DataRow["name"].ToString();
                if (!set.Add(name))
                {
                    index.Add(item.Fid);
                }
            }
            centroid.RemoveShapesAt(index);
            Console.WriteLine("数据删除完毕");
            centroid.SaveAs("newCentroidNoDup.shp", true);
            Console.ReadKey();
        }