示例#1
0
        static void Main(string[] args)
        {
            var options = new Options();
            var parser  = new CommandLineParser();

            if (!parser.ParseArguments(args, options))
            {
                Console.Error.Write(options.Errors());
            }
            else
            {
                Logger.Init(Path.GetDirectoryName(options.Path));

                Projection projection;

                switch (options.Projection)
                {
                case "EPSG:3857":
                    projection = new SphericalMercator();
                    break;

                default:
                    projection = new Mercator();
                    break;
                }
                ;


                var filePaths = Helper.ShpFilePaths(options.Path).ToList();
                filePaths.ForEach(fp =>
                {
                    var svgWriter = new SvgWriter(fp, options.Width, options.Height, options.Tolerance, options.Attr, projection);

                    svgWriter.CreateSVG();

                    if (options.Meta)
                    {
                        svgWriter.GetMetadata(fp);
                    }

                    Logger.LogText(svgWriter.Log);
                });
            }
        }
示例#2
0
文件: Program.cs 项目: Knoema/shp2svg
        static void Main(string[] args)
        {
            var options = new Options();
            var parser = new CommandLineParser();

            if (!parser.ParseArguments(args, options))
                Console.Error.Write(options.Errors());
            else
            {
                Logger.Init(Path.GetDirectoryName(options.Path));

                Projection projection;

                switch (options.Projection)
                {
             					case "EPSG:3857":
                        projection = new SphericalMercator();
                        break;
                    default:
                        projection = new Mercator();
                        break;
                };

                var filePaths = Helper.ShpFilePaths(options.Path).ToList();
                filePaths.ForEach(fp =>
                {
                    var svgWriter = new SvgWriter(fp, options.Width, options.Height, options.Tolerance, options.Attr, projection);

                    svgWriter.CreateSVG();

                    if (options.Meta)
                        svgWriter.GetMetadata(fp);

                    Logger.LogText(svgWriter.Log);
                });

            }
        }