]> granicus.if.org Git - postgis/commitdiff
added -k to raster2pgsql for skipping band is NODATA check
authorBborie Park <bkpark at ucdavis.edu>
Wed, 6 Nov 2013 04:52:17 +0000 (04:52 +0000)
committerBborie Park <bkpark at ucdavis.edu>
Wed, 6 Nov 2013 04:52:17 +0000 (04:52 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@12092 b70326c6-7e19-0410-871a-916f4a2858ee

NEWS
raster/loader/raster2pgsql.c
raster/loader/raster2pgsql.h

diff --git a/NEWS b/NEWS
index cc7d2006649bcf72968dc956cd48f52f300f1340..409fecfdd8dd8d82cbf61eb515ec409da9439e24 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -17,6 +17,8 @@ PostGIS 2.2.0
 
   - #2361, Added spatial_index column to raster_columns view
   - #2390, Testsuite for pgsql2shp
+  - #2527, Added -k flag to raster2pgsql to skip checking that
+           band is NODATA
 
  * Bug Fixes *
 
index eeb2f0ea1ce670361f6e5f8471b90a72e8d07935..c3cda9d21bcbf2baf5375a453b02627df3421674 100644 (file)
@@ -413,6 +413,9 @@ usage() {
        printf(_(
                "  -N <nodata> NODATA value to use on bands without a NODATA value.\n"
        ));
+       printf(_(
+               "  -k  Skip NODATA value checks for each raster band.\n"
+       ));
        printf(_(
                "  -E <endian> Control endianness of generated binary output of\n"
                "      raster. Use 0 for XDR and 1 for NDR (default). Only NDR\n"
@@ -706,6 +709,7 @@ init_config(RTLOADERCFG *config) {
        config->idx_tablespace = NULL;
        config->hasnodata = 0;
        config->nodataval = 0;
+       config->skip_nodataval_check = 0;
        config->endian = 1;
        config->version = 0;
        config->transaction = 1;
@@ -1814,7 +1818,8 @@ convert_raster(int idx, RTLOADERCFG *config, RASTERINFO *info, STRINGBUFFER *til
                                        }
 
                                        /* inspect each band of raster where band is NODATA */
-                                       rt_band_check_is_nodata(band);
+                                       if (!config->skip_nodataval_check)
+                                               rt_band_check_is_nodata(band);
                                }
 
                                /* convert rt_raster to hexwkb */
@@ -1931,7 +1936,7 @@ convert_raster(int idx, RTLOADERCFG *config, RASTERINFO *info, STRINGBUFFER *til
                                numbands = rt_raster_get_num_bands(rast);
                                for (i = 0; i < numbands; i++) {
                                        band = rt_raster_get_band(rast, i);
-                                       if (band != NULL)
+                                       if (band != NULL && !config->skip_nodataval_check)
                                                rt_band_check_is_nodata(band);
                                }
 
@@ -2579,6 +2584,10 @@ main(int argc, char **argv) {
                        config->hasnodata = 1;
                        config->nodataval = atof(argv[++i]);
                }
+               /* skip NODATA value check for bands */
+               else if (CSEQUAL(argv[i], "-k")) {
+                       config->skip_nodataval_check = 1;
+               }
                /* endianness */
                else if (CSEQUAL(argv[i], "-E") && i < argc - 1) {
                        config->endian = atoi(argv[++i]);
index 336b6ac180015c37e2cb46401dedd0268bf90927..d0579f755d0411c7a11d127a0f65418dc2460a80 100644 (file)
@@ -142,6 +142,9 @@ typedef struct raster_loader_config {
        /* nodata value for bands with no nodata value */
        double nodataval;
 
+       /* skip NODATA value check for bands */
+       int skip_nodataval_check;
+
        /* endianness of binary output, 0 = XDR, 1 = NDR (default) */
        int endian;