[gdal-dev] Error in SetGeoTransform
Even Rouault
even.rouault at mines-paris.org
Sat Aug 2 13:00:26 PDT 2014
Le samedi 02 août 2014 13:07:13, Morteza Ghavami a écrit :
> 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 ?
It looks like an ABI mismatch situation. The SetGeoTransform() would be
dispatched at runtime on the AddBand() method. This is very likely as both
methods are following each others in the virtual table. Are you sure you are
compiling against the GDAL headers of the version you are linking to ?
> thanks
--
Geospatial professional services
http://even.rouault.free.fr/services.html
More information about the gdal-dev
mailing list