Esempio n. 1
0
        private static void Main(string[] args)
        {
            Console.WriteLine("\nApplication demonstrating exporting features \nfrom a shapefile into new shapefiles using SharpMap v2\nCopyright Newgrove Consultants Ltd 2008");

            //jd: hopefully a temporary measure
            SridMap.DefaultInstance = new SridMap(new[] { new SridProj4Strategy(0, new GeometryServices().CoordinateSystemFactory) });

            while (ShapeExporter.Run())
            {
            }
        }
Esempio n. 2
0
        public static bool Run()
        {
            Console.WriteLine("Please enter the path to the shapefile");
            string path = Console.ReadLine();

            if (File.Exists(path))
            {
                using (ShapeExporter exporter = new ShapeExporter(path))
                {
                    FeatureDataTable tbl = exporter.Provider.CreateNewTable();
                    Console.WriteLine("The shapefile dbf contains the following columns:");
                    foreach (DataColumn c in tbl.Columns)
                    {
                        Console.WriteLine(c.ColumnName);
                    }

                    Console.WriteLine("Please enter the column name to base the exported file name on");

                    string colName = Console.ReadLine();

                    if (!tbl.Columns.Contains(colName))
                    {
                        Console.WriteLine("Invalid Column");
                    }
                    else
                    {
                        exporter.Export(colName);
                    }
                }
            }
            else
            {
                Console.WriteLine("Invalid Path");
            }

            Console.WriteLine("Run again? Y to run again. Any other key to quit");

            return(Console.ReadLine() == "Y");
        }