private static void CreateIndexFile(string idxPathFileName, string sourceShapeFilePath)
        {
            ShapeFileFeatureLayer sourceLayer = new ShapeFileFeatureLayer(sourceShapeFilePath);

            sourceLayer.RequireIndex = false;
            ShapeFileType shapeFileType = ShapeFileType.Null;

            sourceLayer.SafeProcess(() =>
            {
                shapeFileType = sourceLayer.GetShapeFileType();
            });
            //sourceLayer.Open();
            //ShapeFileType shapeFileType = sourceLayer.GetShapeFileType();
            //sourceLayer.Close();

            if (shapeFileType == ShapeFileType.Point || shapeFileType == ShapeFileType.PointZ || shapeFileType == ShapeFileType.PointM)
            {
                RtreeSpatialIndex.CreatePointSpatialIndex(idxPathFileName, RtreeSpatialIndexPageSize.EightKilobytes, RtreeSpatialIndexDataFormat.Float);
            }
            else
            {
                RtreeSpatialIndex.CreateRectangleSpatialIndex(idxPathFileName, RtreeSpatialIndexPageSize.EightKilobytes, RtreeSpatialIndexDataFormat.Float);
            }
        }
        protected virtual void BuildIndexFileCore(bool rebuild)
        {
            string idxPathFileName = Path.ChangeExtension(CsvPathFileName, ".idx");
            string idsPathFileName = Path.ChangeExtension(CsvPathFileName, ".ids");

            if (!File.Exists(idxPathFileName) && !File.Exists(idsPathFileName) || rebuild)
            {
                if (!string.IsNullOrEmpty(WktColumnName))
                {
                    RtreeSpatialIndex.CreateRectangleSpatialIndex(idxPathFileName, RtreeSpatialIndexPageSize.EightKilobytes, RtreeSpatialIndexDataFormat.Float);
                }
                else
                {
                    RtreeSpatialIndex.CreatePointSpatialIndex(idxPathFileName, RtreeSpatialIndexPageSize.EightKilobytes, RtreeSpatialIndexDataFormat.Float);
                }

                using (RtreeSpatialIndex tempRTree = new RtreeSpatialIndex(idxPathFileName, GeoFileReadWriteMode.ReadWrite))
                {
                    tempRTree.Open();
                    bool     isCanceled = false;
                    DateTime startDate  = DateTime.Now;
                    using (var csvReader = CreateCsvReader())
                    {
                        var allRecords = csvReader.DataRecords.ToArray();
                        int index      = 0;
                        foreach (var currentDataRecord in allRecords)
                        {
                            index++;
                            var feature = GetFeature(index.ToString(), currentDataRecord);
                            if (feature != null)
                            {
                                tempRTree.Add(feature);
                                BuildingIndexCsvFeatureSourceEventArgs e = new BuildingIndexCsvFeatureSourceEventArgs(allRecords.Length, index, feature, startDate, false);
                                OnBuildingIndex(e);
                                if (e.Cancel)
                                {
                                    isCanceled = true;
                                    break;
                                }
                            }
                        }
                    }

                    if (!isCanceled)
                    {
                        tempRTree.Flush();
                    }
                    else
                    {
                        if (File.Exists(idxPathFileName))
                        {
                            File.Delete(idxPathFileName);
                        }
                        if (File.Exists(idsPathFileName))
                        {
                            File.Delete(idsPathFileName);
                        }
                    }
                }
            }
        }