]> granicus.if.org Git - postgis/commitdiff
Fixed handling of out-db rasters with no geotransform matrix
authorBborie Park <bkpark at ucdavis.edu>
Sun, 17 Feb 2013 16:24:32 +0000 (16:24 +0000)
committerBborie Park <bkpark at ucdavis.edu>
Sun, 17 Feb 2013 16:24:32 +0000 (16:24 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@11098 b70326c6-7e19-0410-871a-916f4a2858ee

raster/rt_core/rt_api.c

index f9461a39f337892c6d4006601af626b309780733..cd16a97701159200ee0fd805152ff06659cb8dcd 100644 (file)
@@ -1585,7 +1585,7 @@ rt_band_load_offline_data(rt_band band) {
        VRTDatasetH hdsDst = NULL;
        VRTSourcedRasterBandH hbandDst = NULL;
        double gt[6] = {0.};
-       double ogt[6] = {0.};
+       double ogt[6] = {0};
        double offset[2] = {0};
 
        rt_raster _rast = NULL;
@@ -1631,7 +1631,15 @@ rt_band_load_offline_data(rt_band band) {
                gt[0], gt[1], gt[2], gt[3], gt[4], gt[5]);
 
        /* get offline raster's geotransform */
-       GDALGetGeoTransform(hdsSrc, ogt);
+       if (GDALGetGeoTransform(hdsSrc, ogt) != CE_None) {
+               RASTER_DEBUGF(4, "Using default geotransform matrix (0, 1, 0, 0, 0, -1)");
+               ogt[0] = 0;
+               ogt[1] = 1;
+               ogt[2] = 0;
+               ogt[3] = 0;
+               ogt[4] = 0;
+               ogt[5] = -1;
+       }
        RASTER_DEBUGF(3, "Offline geotransform (%f, %f, %f, %f, %f, %f)",
                ogt[0], ogt[1], ogt[2], ogt[3], ogt[4], ogt[5]);
 
@@ -1656,6 +1664,7 @@ rt_band_load_offline_data(rt_band band) {
                &(offset[0]), &(offset[1]),
                NULL
        );
+
        RASTER_DEBUGF(4, "offsets: (%f, %f)", offset[0], offset[1]);
 
        /* create VRT dataset */