[gdal-dev] MEM Datasets
Chaitanya kumar CH
chaitanya.ch at gmail.com
Tue Jul 13 07:37:35 EDT 2010
James,
You forgot to call GDALAllRegister() before opening the dataset. Then you
will not get a NULL with GDALOpen().
http://www.gdal.org/gdal_tutorial.html
On Tue, Jul 13, 2010 at 3:40 PM, James Meyer <jamesm at lantic.net> wrote:
> Hi
>
> I am trying to use MEM (In-memory) datasets with GDAL.
> However, on trying to close the dataset I get a segmentation fault.
> The dataset is created successfully. The handle returned is valid and I am
> able to read and write to it.
>
> Am I not supposed to try and close the handle or am I doing something else
> wrong?
>
> The code is as follows:
>
> //************************************************
> char filename[255];
> int datasize = 100 * 100 * (GDALGetDataTypeSize(GDT_Byte) / 8);
>
> void* data = malloc(datasize);
> sprintf(filename,
> "MEM:::DATAPOINTER=%p,PIXELS=%d,LINES=%d,BANDS=%d,DATATYPE=%s",
> &data, 100, 100, 1, GDALGetDataTypeName(GDT_Byte));
>
>
> GDALDatasetH dst = GDALOpen(filename,GA_Update);
> GDALDataset* dest = (GDALDataset*) dst;
>
> if (! dest )
> {
> printf("Failed to open Dataset");
> }
> GDALClose(dst); //This fails
> free(data);
> //**************************************************
>
> Thanks
>
> James
> _______________________________________________
> 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-9494447584
17.2416N 80.1426E
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20100713/d8f717f0/attachment.html
More information about the gdal-dev
mailing list