[gdal-dev] Error in SetGeoTransform

Morteza Ghavami smor.prg at gmail.com
Sat Aug 2 04:07:13 PDT 2014


Hello

I trying to make geotiff from float array . when I try to set geotransform
information I get this error :
"Dataset does not support the AddBand() method."

The part of my code that i used to make geotiff listed below (the part of
code that error occurred ):


poDriver=GetGDALDriverManager()->GetDriverByName(pszFormat);
poDstDS = poDriver->Create( outStr.c_str(), outWidth, outHeight,
1,GDT_Float32,papszOptions );
double adfGeoTransform[6] = { static_cast<double>(west),
static_cast<double>(OUTPUT_PIXEL_METER), 0.0, static_cast<double>(north),
0.0, static_cast<double>(-OUTPUT_PIXEL_METER) };
OGRSpatialReference oSRS;
char *pszSRS_WKT = NULL;
GDALRasterBand *poBand;
rasterData=new float[outWidth*outHeight];
OGRErr err=poDstDS->SetGeoTransform(adfGeoTransform);
oSRS.importFromProj4("+proj=merc +ellps=WGS84 +datum=WGS84 +lon_0=0.0
+a=6378137.0 +b=6356752.314 +units=m");

Note : The err value is 3 .
What is wrong with this code ?
thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20140802/4cdab67c/attachment.html>


More information about the gdal-dev mailing list