]> granicus.if.org Git - postgis/commitdiff
Additional test of rt_raster_to_gdal().
authorBborie Park <bkpark at ucdavis.edu>
Sun, 26 Feb 2012 18:31:38 +0000 (18:31 +0000)
committerBborie Park <bkpark at ucdavis.edu>
Sun, 26 Feb 2012 18:31:38 +0000 (18:31 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@9303 b70326c6-7e19-0410-871a-916f4a2858ee

raster/test/core/testapi.c

index d12997290443f35707d8a674517cc027f5cb4ecd..0cdb9f56abf523d7057602938ff3d412ec6024fe 100644 (file)
@@ -1641,6 +1641,30 @@ static void testRasterToGDAL() {
        if (gdal) CPLFree(gdal);
 
        deepRelease(raster);
+
+       raster = rt_raster_new(xmax, ymax);
+       assert(raster); /* or we're out of virtual memory */
+       band = addBand(raster, PT_8BSI, 0, 0);
+       CHECK(band);
+       rt_band_set_nodata(band, 0);
+
+       rt_raster_set_offsets(raster, -500000, 600000);
+       rt_raster_set_scale(raster, 1000, -1000);
+
+       for (x = 0; x < xmax; x++) {
+               for (y = 0; y < ymax; y++) {
+                       rtn = rt_band_set_pixel(band, x, y, x);
+                       CHECK((rtn != -1));
+               }
+       }
+
+       gdal = rt_raster_to_gdal(raster, srs, "PNG", NULL, &gdalSize);
+       /*printf("gdalSize: %d\n", (int) gdalSize);*/
+       CHECK(gdalSize);
+
+       if (gdal) CPLFree(gdal);
+
+       deepRelease(raster);
 }
 
 static void testValueCount() {