-
Notifications
You must be signed in to change notification settings - Fork 1
/
test_gdal.cpp
36 lines (24 loc) · 1008 Bytes
/
test_gdal.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#include <gdal_priv.h>
#include <cpl_conv.h>
int main(int argc, char *argv[])
{
GDALDataset *poDataset;
double adfGeoTransform[6];
GDALAllRegister();
poDataset = (GDALDataset*) GDALOpen( "test_alu_3_fomed_nanfilled_map.cub", GA_ReadOnly );
printf( "Driver: %s/%s\n",
poDataset->GetDriver()->GetDescription(),
poDataset->GetDriver()->GetMetadataItem( GDAL_DMD_LONGNAME ) );
printf( "Size is %dx%dx%d\n",
poDataset->GetRasterXSize(), poDataset->GetRasterYSize(),
poDataset->GetRasterCount() );
if( poDataset->GetProjectionRef() != NULL )
printf( "Projection is `%s'\n", poDataset->GetProjectionRef() );
if( poDataset->GetGeoTransform( adfGeoTransform ) == CE_None )
{
printf( "Origin = (%.6f,%.6f)\n",
adfGeoTransform[0], adfGeoTransform[3] );
printf( "Pixel Size = (%.6f,%.6f)\n",
adfGeoTransform[1], adfGeoTransform[5] );
}
}