Hi,

What I'm attempting to do is write some code to do the following:

PostGIS Raster -> GDAL MEM -> user specified GDAL output format in /vsimem/ (e.g. GTiff) -> return contents of the output file to user

I'm able to successfully create a MEM dataset with raw band data specified using the DATAPOINTER creation option and the GDALRasterIO() function from a PostGIS Raster. I've been successful outputting the MEM dataset using CreateCopy() to a GTiff stored on the filesystem (e.g. /tmp/out.tif), such as...

rtn_ds = GDALCreateCopy(
        rtn_drv,
        "/tmp/out.tif",
        src_ds,
        FALSE,
        options,
        NULL,
        NULL
);

What does not seem to work is if I use CreateCopy with a /vsimem/ path.

rtn_ds = GDALCreateCopy(
        rtn_drv,
        "/vsimem/out.tif",
        src_ds,
        FALSE,
        options,
        NULL,
        NULL
);

rtn = VSIGetMemFileBuffer("/vsimem/out.tif", &j, FALSE);

When I read /vsimem/out.tif back out to pass back to the end-user, the contents are significantly shorter than what it should be. From what I can tell, the contents outputted are just the tiff header information and none of the band data.

Is there something different about outputting a raster to a filesystem rather than /vsimem/ when working with a MEM raster with external band data?

Thanks,
Bborie

--
Bborie Park
Programmer
Center for Vectorborne Diseases
UC Davis
530-752-8380
[email protected]
_______________________________________________
gdal-dev mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/gdal-dev

Reply via email to