]> granicus.if.org Git - postgis/commitdiff
Added value for nBandCount attribute of GDALWarpOptions in rt_raster_transform function.
authorBborie Park <bkpark at ucdavis.edu>
Wed, 15 Jun 2011 14:29:20 +0000 (14:29 +0000)
committerBborie Park <bkpark at ucdavis.edu>
Wed, 15 Jun 2011 14:29:20 +0000 (14:29 +0000)
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

raster/rt_core/rt_api.c

index cb57190aa8dc85a6abd276a62d766bc923f43ed2..95e1d9c53314e32c2115cd1090ba59abdbd7cf5e 100644 (file)
@@ -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);