[gdal-dev] write tif error

Chaitanya kumar CH chaitanya.ch at gmail.com
Wed Apr 14 06:24:40 EDT 2010


weixj2003ld,

Can you provide your code and a link to the sample dataset that shows this
error?

2010/4/14 weixj2003ld <weixj2003ld at 163.com>

>  I use the following code to read data from a geotiff file and do some
> computing and write it into
>  a new one.the bands number is 6; ...
>  GDALDataset *poSrcDS,*poDstDS;//poSrcDs:the source file,poDstDS:the goal
>  source GDALRasterBand *poSrcBand,*poDstBand;//poSrcBand:the source
>  band,poDstBand:the goal band GDALDriver *poDstDriver;
>  double *m_AdGeoTransform=new double[6];
>
>  ...
>
>  poDstDriver=GetGDALDriverManager()->GetDriverByName(poSrcDS->GetDriver()->G
> etDescrition());
>  poDstDS=poDstDriver->create(DstFilename,nX,nY,6,GDT_Float32,NULL);
>  poSrcDS->GetGeoTransform(m_AdGeoTransform)
>  poDstDS->SetGeoTransform(m_AdGeoTransform);
>  poDstDS->SetProjection(poSrcDS->GetProjectionRef());*
>  for(int iBand=0;iBand<6;iBand++)
> {
>     poSrcBand=poSrcDS->GetRaserBand(iBand+1);
>    poDstBand=poDstDS->GetRaserBand(iBand+1);
>    float *pafScanline;
>    pafScanline=(float *)CPLMalloc(sizeof(float)*nX;
>    for(int i=0;i<nY;i++)
>   {
> poSrcBand->RasterIO(GF_Read,0,0,nX,i,pafScanline,nX,1,GDT_Float32,0,0);
>
>  poDstBand->RasterIO(GF_Write,0,0,nX,i,pafScanline,nX,1,GDT_Float32,0,0);//If I comment this code,the program will be ok. }
>  }
> GDALClose((GDALDatasetH)poDstDS);
>
> When I run my program,CPU is very alway busy,and the program is
>  blocked,why?
> *
>
>
>
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev
>



-- 
Best regards,
Chaitanya kumar CH.
/tʃaɪθənjə/ /kʊmɑr/
+91-9848167848
17.2416N 80.1426E
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20100414/00d1b2bd/attachment.html


More information about the gdal-dev mailing list