[gdal-dev] Trouble with GDALAutoCreateWarpedVRT and No data values
Jesse Crocker
jesse at gaiagps.com
Mon Jun 10 17:17:28 PDT 2013
Hello List,
Im having some trouble with the C api, that I assume is do my failure to understand some part of it.
What I'm trying to do: Load a BSB raster file, apply a cutline to the file, and warp it into a north-up projection. Im doing additional transformations to it after that, but right now I'm stuck trying to get areas outside of the cutline to be transparent instead of black.
An abbreviated version of what I'm doing now:
sourceDataset = GDALOpen(imageFilePath.UTF8String, GA_ReadOnly );
GDALWarpOptions *warpOptions = GDALCreateWarpOptions();
OGRGeometryH clipGeometry;
OGRErr polyStatus = OGR_G_CreateFromWkt(&pszWkt, spatialRef, &clipGeometry);
if(polyStatus == CE_None) {
warpOptions->hCutline = clipGeometry;
}
warpedDataset = GDALAutoCreateWarpedVRT(sourceDataset,
NULL,
NULL,
GRA_NearestNeighbour,
0.0,
warpOptions);
The source data does not have a no data value, i've tried setting one and adding an entry to the color palette before calling GDALAutoCreateWarpedVRT, and settings the same value in the VRT but that had no effect.
Any suggestions for the right way to do this? Am I just setting the no_data value incorrectly, or is this a situation that requires a mask band? And if it does require a mask band is there an easy way to create that from a cutline?
Thanks,
Jesse
More information about the gdal-dev
mailing list