当前位置: 首页>>代码示例>>C#>>正文


C# Dataset.GetMetadata方法代码示例

本文整理汇总了C#中OSGeo.GDAL.Dataset.GetMetadata方法的典型用法代码示例。如果您正苦于以下问题:C# Dataset.GetMetadata方法的具体用法?C# Dataset.GetMetadata怎么用?C# Dataset.GetMetadata使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在OSGeo.GDAL.Dataset的用法示例。


在下文中一共展示了Dataset.GetMetadata方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GDAL_Info

        public GDAL_Info(Dataset ds)
        {
            Projection = ds.GetProjectionRef();
            Resolution = new Size(ds.RasterXSize, ds.RasterYSize);
            Bands = new DataBandInfo[ds.RasterCount];
            for (int i = 0; i < ds.RasterCount; i++)
            {
                Band band = ds.GetRasterBand(i + 1);
                Bands[i] = new DataBandInfo();
                int temp;
                band.GetMaximum(out Bands[i].MaxValue, out temp);
                band.GetMaximum(out Bands[i].MinValue, out temp);
                band.GetNoDataValue(out Bands[i].NODATAValue, out temp);
                ColorInterp clr = band.GetRasterColorInterpretation();
                switch (clr)
                {
                    case ColorInterp.GCI_RedBand:
                        Bands[i].Name = "RedBand";
                        Bands[i].Image = Resource1.red_layer;
                        BppType += "R";
                        break;
                    case ColorInterp.GCI_GreenBand:
                        Bands[i].Name = "GreenBand";
                        Bands[i].Image = Resource1.green_layer;
                        BppType += "G";
                        break;
                    case ColorInterp.GCI_BlueBand:
                        Bands[i].Name = "BlueBand";
                        Bands[i].Image = Resource1.blue_layer;
                        BppType += "B";
                        break;
                    default:
                        Bands[i].Name = clr.ToString();
                        Bands[i].Image = null;
                        BppType += "?";
                        break;
                }
                BppType += "[" + Gdal.GetDataTypeName(band.DataType) + "]";
                Bpp += (ushort)Gdal.GetDataTypeSize(band.DataType);

                if (i + 1 < ds.RasterCount)
                    BppType += ",";
            }
            BppType += " (" + Bpp + ")";
            
            Driver = ds.GetDriver().LongName;

            Metadata = ds.GetMetadata("");
            ImgMetadata = ds.GetMetadata("IMAGE_STRUCTURE");
            SubDSMetadata = ds.GetMetadata("SUBDATASETS");
            GeoLocMetadata = ds.GetMetadata("GEOLOCATION");

            GDALInfoGetPosition(ds, 0.0, 0.0, out UpperLeftX, out UpperLeftY);
            GDALInfoGetPosition(ds, 0.0, ds.RasterYSize, out UpperRightX, out UpperRightY);
            GDALInfoGetPosition(ds, ds.RasterXSize, 0.0, out LowerLeftX, out LowerLeftY);
            GDALInfoGetPosition(ds, ds.RasterXSize, ds.RasterYSize, out LowerRightX, out LowerRightY);
            GDALInfoGetPosition(ds, ds.RasterXSize / 2, ds.RasterYSize / 2, out CenterX, out CenterY);
        }
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:58,代码来源:GDALReader.cs


注:本文中的OSGeo.GDAL.Dataset.GetMetadata方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。