GDAL的GDALDataset::GetGeoTransform()函数

     

      GDALDataset中有函数GetGeoTransform(),函数声明为: CPLErr GDALDataset::GetGeoTransform  ( double *  padfTransform  )。

        GDAL官网对该函数说明为:

        Fetch the affine transformation coefficients.

        Fetches the coefficients for transforming between pixel/line (P,L) raster space, and projection coordinates (Xp,Yp) space。

                             Xp = padfTransform[0] + P*padfTransform[1] + L*padfTransform[2];

                             Yp = padfTransform[3] + P*padfTransform[4] + L*padfTransform[5];

      参数padfTransform是一个指向六个元素的double类型指针,各个元素意义如下:

      In a north up image, padfTransform[1] is the pixel width, and padfTransform[5] is the pixel height. The upper left corner of the upper left pixel is at position (padfTransform[0],padfTransform[3]).

      The default transform is (0,1,0,0,0,1) and should be returned even when a CE_Failure error is returned, such as for formats that don’t support transformation to projection coordinates.

 

Parameters:
      padfTransform  an existing six double buffer into which the transformation will be placed.

Returns:
      CE_None on success, or CE_Failure if no transform can be fetched.

 

 //如果图像不含地理坐标信息,默认返回值是:(0,1,0,0,0,1)
 //In a north up image,
 //左上角点坐标(padfGeoTransform[0],padfGeoTransform[3]);
 //padfGeoTransform[1]是像元宽度(影像在宽度上的分辨率);
 /p/adfGeoTransform[5]是像元高度(影像在高度上的分辨率);
 //如果影像是指北的,padfGeoTransform[2]和padfGeoTransform[4]这两个参数的值为0。

 

转载自:https://blog.csdn.net/yyt_EnjoyVC/article/details/7828368

You may also like...

退出移动版