Exemple #1
0
        public bool WarpRaster(string srcFilename, string dstFilename, ISpatialReference newProjection)
        {
            string options = string.Format("-t_srs \"{0}\"", newProjection.ExportToProj4());

            options += " -r lanczos -co COMPRESS=LZW -co predictor=2 -co TILED=yes"; // TODO: вынести в диалог

            return(_utils.GDALWarp(srcFilename, dstFilename, options));
        }
Exemple #2
0
        /// <summary>
        /// Returns code that correspnds to the given dialect string
        /// </summary>
        /// <param name="proj">Projection object; WKT, proj4 formats will be tested</param>
        /// <returns>EPSG code</returns>
        public int EpsgCodeByDialectString(ISpatialReference proj)
        {
            var code = EpsgCodeByDialectString(proj.ExportToProj4());

            if (code == -1)
            {
                code = EpsgCodeByDialectString(proj.ExportToWkt());
            }

            if (code == -1)
            {
                code = EpsgCodeByDialectString(proj.ExportToEsri());
            }

            return(code);
        }
Exemple #3
0
        /// <summary>
        /// Returns coordinate system object associated with given GeoProjection.
        /// This property is computationally expensive.
        /// </summary>
        public ICoordinateSystem GetCoordinateSystem(ISpatialReference projection, ProjectionSearchType searchType)
        {
            if (string.IsNullOrWhiteSpace(_dbname))
            {
                return(null);
            }

            if (projection == null || projection.IsEmpty)
            {
                return(null);
            }

            // standard
            var cs = GetCoordinateSystemCore(projection);

            if (searchType == ProjectionSearchType.Standard || cs != null)
            {
                return(cs);
            }

            // enhanced
            var projTest = new SpatialReference();

            if (projTest.ImportFromProj4(projection.ExportToProj4()))
            {
                cs = GetCoordinateSystemCore(projection);
            }

            if (searchType == ProjectionSearchType.Enhanced || cs != null)
            {
                return(cs);
            }

            // dialects
            RefreshDialects();
            int code = EpsgCodeByDialectString(projection);

            if (code != -1)
            {
                return(GetCoordinateSystem(code));
            }

            return(null);
        }
        /// <summary>
        /// Creates a new instance of the frmProjectionCompare class
        /// </summary>
        public CompareProjectionForm(IAppContext context, ISpatialReference projectProj, ISpatialReference layerProj)
            : base(context)
        {
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }
            InitializeComponent();

            _layerProj = layerProj;

            lblProject.Text = "Project: " + projectProj.Name;
            lblLayer.Text   = "Layer: " + layerProj.Name;

            txtProject.Text = projectProj.ExportToProj4();
            txtLayer.Text   = layerProj.ExportToProj4();

            btnLayer.Click   += (s, e) => ShowProjectionProperties(_layerProj);
            btnProject.Click += (s, e) => ShowProjectionProperties(_layerProj);
        }
Exemple #5
0
        public bool WarpRaster(string srcFilename, string dstFilename, ISpatialReference newProjection)
        {
            string options = string.Format("-t_srs \"{0}\"", newProjection.ExportToProj4());

            return(_utils.GDALWarp(srcFilename, dstFilename, options));
        }