From: Bborie Park Date: Wed, 15 Jun 2011 14:29:20 +0000 (+0000) Subject: Added value for nBandCount attribute of GDALWarpOptions in rt_raster_transform function. X-Git-Tag: 2.0.0alpha1~1424 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e10aa96ecba481b910fe3c1054e488c5017aad17;p=postgis Added value for nBandCount attribute of GDALWarpOptions in rt_raster_transform function. This is based upon the discussion found at: http://lists.osgeo.org/pipermail/gdal-dev/2011-May/028730.html Related ticket is #1015 git-svn-id: http://svn.osgeo.org/postgis/trunk@7399 b70326c6-7e19-0410-871a-916f4a2858ee --- diff --git a/raster/rt_core/rt_api.c b/raster/rt_core/rt_api.c index cb57190aa..95e1d9c53 100644 --- a/raster/rt_core/rt_api.c +++ b/raster/rt_core/rt_api.c @@ -5944,6 +5944,7 @@ rt_raster_transform(rt_raster raster, char *src_srs, char *dst_srs, RASTER_DEBUG(3, "Setting nodata mapping"); numBands = rt_raster_get_num_bands(raster); wopts = GDALCreateWarpOptions(); + wopts->nBandCount = numBands; wopts->padfSrcNoDataReal = (double *) CPLMalloc(numBands * sizeof(double)); wopts->padfDstNoDataReal = (double *) CPLMalloc(numBands * sizeof(double)); wopts->padfSrcNoDataImag = (double *) CPLMalloc(numBands * sizeof(double)); @@ -6008,7 +6009,7 @@ rt_raster_transform(rt_raster raster, char *src_srs, char *dst_srs, RASTER_DEBUG(3, "Raster reprojected"); if (NULL == dst_ds) { rterror("rt_raster_transform: Unable to transform raster\n"); - if (NULL != wopts) GDALDestroyWarpOptions(wopts); + GDALDestroyWarpOptions(wopts); GDALClose(src_ds); GDALDeregisterDriver(src_drv); GDALDestroyDriver(src_drv); @@ -6019,7 +6020,7 @@ rt_raster_transform(rt_raster raster, char *src_srs, char *dst_srs, RASTER_DEBUG(3, "Converting GDAL dataset to raster"); rast = rt_raster_from_gdal_dataset(dst_ds); - if (NULL != wopts) GDALDestroyWarpOptions(wopts); + GDALDestroyWarpOptions(wopts); GDALClose(dst_ds); GDALClose(src_ds); GDALDeregisterDriver(src_drv);