[gdal-dev] regarding GDALDriver::Create

Srikanth srikanth1947 at gmail.com
Wed Aug 19 07:28:44 EDT 2009


Hi ,

Thanks for the mail Frank.

The problem is rightly pointed. In my case the dataset (poDataset) is not
getting created at times (parameters being the same) . I have checked
thoroughly everything related to this, but did not find any either solution
or problem.

I would appreciate if you can assist me solving this issue.

Regards,
Srikanth



On Fri, Aug 14, 2009 at 5:31 PM, Frank Warmerdam <warmerdam at pobox.com>wrote:

> On Fri, Aug 14, 2009 at 2:59 AM, Srikanth<srikanth1947 at gmail.com> wrote:
> > Dear All,
> >
> > I am reading and writing raster images using GDAL. Below is the code
> which I
> > am using for writing a raster.
> > At times the code is working fine. But many a time , it is getting
> crashed
> > in the GetRasterBand. I have debugged the code several times and the
> > variables passed seems to be perfect. Any help in this is regard would be
> > appreciated.
> ...
> >    poDataset=NULL;
> >    poDataset = poDriver->Create(filename , width , height , numOfbands
> > ,(GDALDataType)datatype,NULL);
> >
> >    for(int i=0 ; i < numOfbands ; i++)
> >      {
> >              poBand[i] = poDataset->GetRasterBand(i+1);
> >       }
>
> Hi,
>
> I didn't see any showstopper problems in your code.  But
> the above code is not safe if the dataset creation fails.
> If the dataset creation fails, a null pointer will be returned
> and GetRasterBand() will fail - possibly crashing.
>
> Best regards,
> --
>
> ---------------------------------------+--------------------------------------
> I set the clouds in motion - turn up   | Frank Warmerdam,
> warmerdam at pobox.com
> light and sound - activate the windows | http://pobox.com/~warmerdam
> and watch the world go round - Rush    | Geospatial Programmer for Rent
>



-- 
Regards,
Srikanth K.
www.servetheneedy.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20090819/b46b1e6a/attachment-0001.html


More information about the gdal-dev mailing list