GDAL获取遥感图像基本信息
GDAL库中的枚举类型定义位于gdal.h文件中。 其中包含了GDAL库定义的数据类型,GDALDataType
enum GDALDataType
Pixel data typesEnumerator:GDT_Unknown Unknown or unspecified type
GDT_Byte Eight bit unsigned integer
GDT_UInt16 Sixteen bit unsigned integer
GDT_Int16 Sixteen bit signed integer
GDT_UInt32 Thirty two bit unsigned integer
GDT_Int32 Thirty two bit signed integer
GDT_Float32 Thirty two bit floating pointGDT_Float64 Sixty four bit floating pointGDT_CInt16 Complex Int16GDT_CInt32 Complex Int32GDT_CFloat32 Complex Float32GDT_CFloat64 Complex Float64
GDAL支持的数据格式完整见:GDAL Raster Formats。主要的数据类型如下:
GeoTIFF (GTiff)Geosoft GXF (GXF)Erdas Imagine (HFA)CEOS (CEOS)ELAS (ELAS)Arc/Info Binary Grid (AIGrid)SDTS Raster DEM (SDTS)OGDI (OGDI)ESRI Labelled BIL (EHdr)PCI .aux Labelled Raw Raster (PAux)HDF4 Hierachal Data Format Release 4HDF5 Hierachal Data Format Release 5GSAG Golden Software ASCII GridGSBG Golden Software Binary Grid
通过GDAL读取遥感影像的基本信息:
GDALAllRegister(); //注册驱动
string file;
file = path + name;GDALDataset* dataset_Origin = (GDALDataset*)GDALOpen(file.c_str(),GA_ReadOnly);//打开数据
const int rasterXSize = dataset_Origin->GetRasterXSize();//数据X宽度const int rasterYSize = dataset_Origin->GetRasterYSize();//数据Y宽度const int rasterBandCount = dataset_Origin->GetRasterCount(); //数据波段数string descrip = dataset_Origin->GetDriver()->GetDescription();//数据格式double rasterGeoTransform[6];
dataset_Origin->GetGeoTransform(rasterGeoTransform);//仿射参数
const string projectionRef_Origin = dataset_Origin->GetProjectionRef();//空间参考信息