[gdal-dev] projection error
y hema
yhema.2705 at gmail.com
Tue Sep 8 05:43:51 PDT 2015
hi ,
poDataset = (GDALDataset *) GDALOpen( pszFilename, GA_ReadOnly );
if( poDataset != NULL )
{
numBands = poDataset->GetRasterCount();
width = poDataset->GetRasterXSize();
height = poDataset->GetRasterYSize();
GDALRasterBand *poBand;
poBands = new GDALRasterBand*[numBands];
poBand = poDataset->GetRasterBand(1);
dataType = (GDALDataType)poBand->GetRasterDataType();
bytesPerPixel =GDALGetDataTypeSize((GDALDataType)dataType)/8;
}
const char *ch = poDataset->GetProjectionRef();
double *tiepoints = new double[6];
poDataset->GetGeoTransform(tiepoints);
for(int i=0;i<6;i++)
{
qDebug()<<"tie points"<< tiepoints[0];
}
uchar *data;
data = (uchar *) /*CPLMalloc*/new
char[(sizeof(uchar)*width*height*bytesPerPixel*numBands)];
int bandIndices[numBands];
double scale = 5.0;
for(int j=0 ;j<numBands ;j++)
{
bandIndices[j] = j;
}
for(int i = 0; i < numBands; i++)
{
poBands[i] = poDataset->GetRasterBand(bandIndices[i]+1);
poBands[i]->SetScale(10);
poBands[i]->RasterIO(GF_Read, 0, 0, width,
height,data+(bytesPerPixel*i), width, height, (GDALDataType)dataType,
numBands*bytesPerPixel, 0);
}
actually i am trying to read the projection string and the tie points .the
above is the code im using.
thanks,
hema
On Tue, Sep 8, 2015 at 5:21 PM, Jukka Rahkonen <
jukka.rahkonen at maanmittauslaitos.fi> wrote:
> Hema Yeedunuri <hema.yeedunuri <at> amigooptima.in> writes:
>
> > hi all,
> > i have a geotiff file .i have wrapper classes for gdal for reading and
> writing.gdal version is 1.11 and proj is 4.2 .whe i try to load a file it
> is
> giving following error.i am using ubuntu 12.04.
> > ERROR 1: Only OGC WKT Projections supported for writing to GeoTIFF.
>
> I fear that with that information nobody can solve your issue. The error
> suggests that you are trying to write into GeoTIFF something that is not
> OGC
> WKT Projection. You must tell us what you try to write into GeoTIFF, even
> better if you attach the failing code as well.
>
> You say that you try to load a file and the error says that you try to
> write
> something invalid into a file so perhaps your code does not do what you
> believe it does.
>
> For self-help I believe this is useful
> http://www.gdal.org/osr_tutorial.html
> and probably this also
>
> http://stackoverflow.com/questions/13158795/create-a-geotiff-from-an-existing-bitmap-in-c-sharp-with-gdal
> .
>
> -Jukka Rahkonen-
>
>
>
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20150908/2470cad4/attachment.html>
More information about the gdal-dev
mailing list