[postgis-commits] svn - r3624 - in spike/wktraster: rt_core rt_pg/test

postgis-commits at postgis.refractions.net postgis-commits at postgis.refractions.net
Tue Feb 3 03:02:43 PST 2009


Author: strk
Date: 2009-02-03 03:02:42 -0800 (Tue, 03 Feb 2009)
New Revision: 3624

Modified:
   spike/wktraster/rt_core/rt_api.c
   spike/wktraster/rt_core/rt_api.h
   spike/wktraster/rt_core/testwkb.c
   spike/wktraster/rt_pg/test/io.sql.c
Log:
add external band path and band num extraction functions in api,
complete sql tests for all types (except 16bf, which is still unimplemented)


Modified: spike/wktraster/rt_core/rt_api.c
===================================================================
--- spike/wktraster/rt_core/rt_api.c	2009-02-03 07:20:16 UTC (rev 3623)
+++ spike/wktraster/rt_core/rt_api.c	2009-02-03 11:02:42 UTC (rev 3624)
@@ -315,6 +315,28 @@
     ctx->dealloc(band);
 }
 
+const char*
+rt_band_get_ext_path(rt_context ctx, rt_band band)
+{
+    if ( ! band->offline ) {
+        ctx->warn("rt_band_get_ext_path: non-offline band doesn't have "
+                  "an associated path");
+        return 0;
+    }
+    return band->data.offline.path;
+}
+
+uint8_t
+rt_band_get_ext_band_num(rt_context ctx, rt_band band)
+{
+    if ( ! band->offline ) {
+        ctx->warn("rt_band_get_ext_path: non-offline band doesn't have "
+                  "an associated band number");
+        return 0;
+    }
+    return band->data.offline.bandNum;
+}
+
 void *
 rt_band_get_data(rt_context ctx, rt_band band)
 {
@@ -1639,28 +1661,29 @@
         }
         band->data.offline.bandNum = read_int8(ptr);
 
-        /* check we have a NULL-termination */
-        sz=0;
-        while (**ptr && *ptr < end) ++sz;
-        if ( *ptr >= end )
         {
-            ctx->err("Premature end of WKB on band offline path reading");
-            ctx->dealloc(band);
-            return 0;
+            /* check we have a NULL-termination */
+            sz=0;
+            while ( (*ptr)[sz] && &((*ptr)[sz]) < end) ++sz;
+            if ( &((*ptr)[sz]) >= end )
+            {
+                ctx->err("Premature end of WKB on band offline path reading");
+                ctx->dealloc(band);
+                return 0;
+            }
+
+            band->ownsData = 1;
+        	band->data.offline.path = ctx->alloc(sz+1);
+            memcpy(band->data.offline.path, *ptr, sz);
+            band->data.offline.path[sz] = '\0';
+            ctx->info("OFFDB band path is %s (size is %d)",
+                band->data.offline.path, sz);
+            *ptr += sz+1;
         }
-
-        band->ownsData = 1;
-	{
-		size_t pathlen = strlen((char*)*ptr);
-        	band->data.offline.path = ctx->alloc(pathlen+1);
-		memcpy(band->data.offline.path, *ptr, pathlen);
-		band->data.offline.path[pathlen] = '\0';
-	}
-        *ptr += sz;
         return band;
     }
 
-    /* This is an offline band */
+    /* This is an on-disk band */
     sz = width*height*pixbytes;
     if (((*ptr)+sz) > end)
     {
@@ -2191,11 +2214,11 @@
 
     ptr = ret;
 
-	printf("sizeof(struct rt_raster_serialized_t):%d\n",
+	printf("sizeof(struct rt_raster_serialized_t):%ld\n",
 		sizeof(struct rt_raster_serialized_t));
-	printf("sizeof(struct rt_raster_t):%d\n",
+	printf("sizeof(struct rt_raster_t):%ld\n",
 		sizeof(struct rt_raster_t));
-	printf("serialized size:%d\n", size);
+	printf("serialized size:%lu\n", (long unsigned)size);
 
     /* Set size */
     raster->size = size;

Modified: spike/wktraster/rt_core/rt_api.h
===================================================================
--- spike/wktraster/rt_core/rt_api.h	2009-02-03 07:20:16 UTC (rev 3623)
+++ spike/wktraster/rt_core/rt_api.h	2009-02-03 11:02:42 UTC (rev 3624)
@@ -156,6 +156,19 @@
  */
 int rt_band_is_offline(rt_context ctx, rt_band band);
 
+/**
+ * Return bands' external path (only valid when rt_band_is_offline
+ * returns non-zero).
+ */
+const char* rt_band_get_ext_path(rt_context ctx, rt_band band);
+
+/**
+ * Return bands' external band number (only valid when
+ * rt_band_is_offline returns non-zero).
+ */
+uint8_t rt_band_get_ext_band_num(rt_context ctx, rt_band band);
+ 
+
 /* Get pixeltype of this band */
 rt_pixtype rt_band_get_pixtype(rt_context ctx, rt_band band);
 

Modified: spike/wktraster/rt_core/testwkb.c
===================================================================
--- spike/wktraster/rt_core/testwkb.c	2009-02-03 07:20:16 UTC (rev 3623)
+++ spike/wktraster/rt_core/testwkb.c	2009-02-03 11:02:42 UTC (rev 3624)
@@ -384,7 +384,66 @@
     free(out);
 
     /* ------------------------------------------------------ */
+    /* 3x2, bit endian, band0(16BSI ext: 3;/tmp/t.tif)        */
+    /* ------------------------------------------------------ */
 
+    hexwkb =
+"00"               /* big endian (uint8 xdr) */
+"0000"             /* version (uint16 0) */
+"0001"             /* nBands (uint16 1) */
+"3FF0000000000000" /* scaleX (float64 1) */
+"4000000000000000" /* scaleY (float64 2) */
+"4008000000000000" /* ipX (float64 3) */
+"4010000000000000" /* ipY (float64 4) */
+"4014000000000000" /* skewX (float64 5) */
+"4018000000000000" /* skewY (float64 6) */
+"0000000A"         /* SRID (int32 10) */
+"0003"             /* width (uint16 3) */
+"0002"             /* height (uint16 2) */
+"85"               /* First band type (16BSI, on disk) */
+"FFFF"             /* nodata value (-1) */
+"03"               /* ext band num == 3 */
+/* ext band path == /tmp/t.tif */
+"2F746D702F742E74696600" 
+    ;
+
+    raster = rt_raster_from_hexwkb(ctx, hexwkb, strlen(hexwkb));
+    CHECK(raster);
+    CHECK_EQUALS(rt_raster_get_num_bands(ctx, raster), 1);
+    CHECK_EQUALS(rt_raster_get_pixel_width(ctx, raster), 1);
+    CHECK_EQUALS(rt_raster_get_pixel_height(ctx, raster), 2);
+    CHECK_EQUALS(rt_raster_get_x_offset(ctx, raster), 3);
+    CHECK_EQUALS(rt_raster_get_y_offset(ctx, raster), 4);
+    CHECK_EQUALS(rt_raster_get_x_rotation(ctx, raster), 5);
+    CHECK_EQUALS(rt_raster_get_y_rotation(ctx, raster), 6);
+    CHECK_EQUALS(rt_raster_get_srid(ctx, raster), 10);
+    CHECK_EQUALS(rt_raster_get_width(ctx, raster), 3);
+    CHECK_EQUALS(rt_raster_get_height(ctx, raster), 2);
+    {
+        rt_band band = rt_raster_get_band(ctx, raster, 0);
+        CHECK(band);
+        CHECK_EQUALS(rt_band_get_pixtype(ctx, band), PT_16BSI);
+        CHECK(rt_band_is_offline(ctx, band));
+        CHECK_EQUALS(rt_band_get_nodata(ctx, band), -1);
+        printf("ext band path: %s\n", rt_band_get_ext_path(ctx, band));
+        printf("ext band  num: %d\n", rt_band_get_ext_band_num(ctx, band));
+        CHECK( ! strcmp(rt_band_get_ext_path(ctx, band), "/tmp/t.tif"));
+        CHECK_EQUALS(rt_band_get_ext_band_num(ctx, band), 3);
+    }
+
+    out  = rt_raster_to_hexwkb(ctx, raster, &len);
+    printf(" in hexwkb len: %d\n", strlen(hexwkb));
+    printf("out hexwkb len: %d\n", len);
+    CHECK_EQUALS(len, strlen(hexwkb));
+/* would depend on machine endian
+    CHECK( ! strcmp(hexwkb, out) );
+*/
+
+    rt_raster_destroy(ctx, raster);
+    free(out);
+
+    /* ------------------------------------------------------ */
+
     printf("All tests successful !\n");
 
     return EXIT_SUCCESS;

Modified: spike/wktraster/rt_pg/test/io.sql.c
===================================================================
--- spike/wktraster/rt_pg/test/io.sql.c	2009-02-03 07:20:16 UTC (rev 3623)
+++ spike/wktraster/rt_pg/test/io.sql.c	2009-02-03 11:02:42 UTC (rev 3624)
@@ -96,7 +96,7 @@
 ||
 '00' -- novalue==0
 ||
-'01' -- pixat(1,1)==1
+'01' -- pixel(0,0)==1
 )
 ,
 (
@@ -128,67 +128,74 @@
 ||
 '00' -- novalue==0
 ||
-'01' -- pixat(1,1)==1
+'01' -- pixel(0,0)==1
 )
 );
 
-#if 0
 -- 1x1, single band of type 2BUI, no transform, scale 1:1
 INSERT INTO rt_test (id, name, hexwkb_ndr, hexwkb_xdr)
 VALUES ( 2, '1x1 single band (2BUI) no transform',
 (
 '01' -- little endian (uint8 ndr)
 || 
-'0100' -- width (uint16 1)
+'0000' -- version (uint16 0)
 ||
-'0100' -- height (uint16 1)
+'0100' -- nBands (uint16 1)
 ||
-'0000803F' -- scaleX (float32 1)
+'000000000000F03F' -- scaleX (float64 1)
 ||
-'0000803F' -- scaleY (float32 1)
+'000000000000F03F' -- scaleY (float64 1)
 ||
-'00000000' -- ipX (float32 0)
+'0000000000000000' -- ipX (float64 0)
 ||
-'00000000' -- ipY (float32 0)
+'0000000000000000' -- ipY (float64 0)
 ||
-'00000000' -- skewX (float32 0)
+'0000000000000000' -- skewX (float64 0)
 ||
-'00000000' -- skewY (float32 0)
+'0000000000000000' -- skewY (float64 0)
 ||
 '0A000000' -- SRID (int32 10)
+|| 
+'0100' -- width (uint16 1)
 ||
-'0100' -- nBands (uint16 1)
+'0100' -- height (uint16 1)
 ||
 '01' -- first band type (2BUI)
 ||
-'30' -- 0011.0000 -- novalue==0, pixel(1,1)==3
+'00' -- novalue==0
+||
+'03' -- pixel(0,0)==3
 ),
 (
 '00' -- big endian (uint8 xdr)
 || 
-'0001' -- width (uint16 1)
+'0000' -- version (uint16 0)
 ||
-'0001' -- height (uint16 1)
+'0001' -- nBands (uint16 1)
 ||
-'3F800000' -- scaleX (float32 1)
+'3FF0000000000000' -- scaleX (float64 1)
 ||
-'3F800000' -- scaleY (float32 1)
+'3FF0000000000000' -- scaleY (float64 1)
 ||
-'00000000' -- ipX (float32 0)
+'0000000000000000' -- ipX (float64 0)
 ||
-'00000000' -- ipY (float32 0)
+'0000000000000000' -- ipY (float64 0)
 ||
-'00000000' -- skewX (float32 0)
+'0000000000000000' -- skewX (float64 0)
 ||
-'00000000' -- skewY (float32 0)
+'0000000000000000' -- skewY (float64 0)
 ||
 '0000000A' -- SRID (int32 10)
 ||
-'0001' -- nBands (uint16 1)
+'0001' -- width (uint16 1)
 ||
+'0001' -- height (uint16 1)
+||
 '01' -- first band type (2BUI)
 ||
-'30' -- 0011.0000 -- novalue==0, pixel(1,1)==3
+'00' -- novalue==0
+||
+'03' -- pixel(0,0)==3
 ) );
 
 -- 1x1, single band of type 4BUI, no transform, scale 1:1
@@ -197,56 +204,64 @@
 (
 '01' -- little endian (uint8 ndr)
 || 
-'0100' -- width (uint16 1)
+'0000' -- version (uint16 0)
 ||
-'0100' -- height (uint16 1)
+'0100' -- nBands (uint16 1)
 ||
-'0000803F' -- scaleX (float32 1)
+'000000000000F03F' -- scaleX (float64 1)
 ||
-'0000803F' -- scaleY (float32 1)
+'000000000000F03F' -- scaleY (float64 1)
 ||
-'00000000' -- ipX (float32 0)
+'0000000000000000' -- ipX (float64 0)
 ||
-'00000000' -- ipY (float32 0)
+'0000000000000000' -- ipY (float64 0)
 ||
-'00000000' -- skewX (float32 0)
+'0000000000000000' -- skewX (float64 0)
 ||
-'00000000' -- skewY (float32 0)
+'0000000000000000' -- skewY (float64 0)
 ||
 '0A000000' -- SRID (int32 10)
+|| 
+'0100' -- width (uint16 1)
 ||
-'0100' -- nBands (uint16 1)
+'0100' -- height (uint16 1)
 ||
 '02' -- first band type (4BUI)
 ||
-'0F' -- 0000.1111 -- novalue==0, pixel(1,1)=15
+'00' -- novalue==0
+||
+'0F' -- pixel(0,0)==15
 ),
 (
 '00' -- big endian (uint8 xdr)
 || 
-'0001' -- width (uint16 1)
+'0000' -- version (uint16 0)
 ||
-'0001' -- height (uint16 1)
+'0001' -- nBands (uint16 1)
 ||
-'3F800000' -- scaleX (float32 1)
+'3FF0000000000000' -- scaleX (float64 1)
 ||
-'3F800000' -- scaleY (float32 1)
+'3FF0000000000000' -- scaleY (float64 1)
 ||
-'00000000' -- ipX (float32 0)
+'0000000000000000' -- ipX (float64 0)
 ||
-'00000000' -- ipY (float32 0)
+'0000000000000000' -- ipY (float64 0)
 ||
-'00000000' -- skewX (float32 0)
+'0000000000000000' -- skewX (float64 0)
 ||
-'00000000' -- skewY (float32 0)
+'0000000000000000' -- skewY (float64 0)
 ||
 '0000000A' -- SRID (int32 10)
 ||
-'0001' -- nBands (uint16 1)
+'0001' -- width (uint16 1)
 ||
-'02' -- first band type (1BB)
+'0001' -- height (uint16 1)
 ||
-'0F' -- 0000.1111 -- novalue==0, pixel(1,1)=15
+'02' -- first band type (4BUI)
+||
+'00' -- novalue==0
+||
+'0F' -- pixel(0,0)==15
 ) );
 
 -- 1x1, single band of type 8BSI, no transform, scale 1:1
@@ -255,56 +270,64 @@
 (
 '01' -- little endian (uint8 ndr)
 || 
-'0100' -- width (uint16 1)
+'0000' -- version (uint16 0)
 ||
-'0100' -- height (uint16 1)
+'0100' -- nBands (uint16 1)
 ||
-'0000803F' -- scaleX (float32 1)
+'000000000000F03F' -- scaleX (float64 1)
 ||
-'0000803F' -- scaleY (float32 1)
+'000000000000F03F' -- scaleY (float64 1)
 ||
-'00000000' -- ipX (float32 0)
+'0000000000000000' -- ipX (float64 0)
 ||
-'00000000' -- ipY (float32 0)
+'0000000000000000' -- ipY (float64 0)
 ||
-'00000000' -- skewX (float32 0)
+'0000000000000000' -- skewX (float64 0)
 ||
-'00000000' -- skewY (float32 0)
+'0000000000000000' -- skewY (float64 0)
 ||
 '0A000000' -- SRID (int32 10)
+|| 
+'0100' -- width (uint16 1)
 ||
-'0100' -- nBands (uint16 1)
+'0100' -- height (uint16 1)
 ||
 '03' -- first band type (8BSI)
 ||
-'00FF' -- 0000.0000 1111.1111 -- novalue==0, pixel(1,1)=-1
+'00' -- novalue==0
+||
+'FF' -- pixel(0,0)==-1
 ),
 (
 '00' -- big endian (uint8 xdr)
 || 
-'0001' -- width (uint16 1)
+'0000' -- version (uint16 0)
 ||
-'0001' -- height (uint16 1)
+'0001' -- nBands (uint16 1)
 ||
-'3F800000' -- scaleX (float32 1)
+'3FF0000000000000' -- scaleX (float64 1)
 ||
-'3F800000' -- scaleY (float32 1)
+'3FF0000000000000' -- scaleY (float64 1)
 ||
-'00000000' -- ipX (float32 0)
+'0000000000000000' -- ipX (float64 0)
 ||
-'00000000' -- ipY (float32 0)
+'0000000000000000' -- ipY (float64 0)
 ||
-'00000000' -- skewX (float32 0)
+'0000000000000000' -- skewX (float64 0)
 ||
-'00000000' -- skewY (float32 0)
+'0000000000000000' -- skewY (float64 0)
 ||
 '0000000A' -- SRID (int32 10)
 ||
-'0001' -- nBands (uint16 1)
+'0001' -- width (uint16 1)
 ||
+'0001' -- height (uint16 1)
+||
 '03' -- first band type (8BSI)
 ||
-'00FF' -- 0000.0000 1111.1111 -- novalue==0, pixel(1,1)=-1
+'00' -- novalue==0
+||
+'FF' -- pixel(0,0)==-1
 ) );
 
 -- 1x1, single band of type 8BUI, no transform, scale 1:1
@@ -313,56 +336,64 @@
 (
 '01' -- little endian (uint8 ndr)
 || 
-'0100' -- width (uint16 1)
+'0000' -- version (uint16 0)
 ||
-'0100' -- height (uint16 1)
+'0100' -- nBands (uint16 1)
 ||
-'0000803F' -- scaleX (float32 1)
+'000000000000F03F' -- scaleX (float64 1)
 ||
-'0000803F' -- scaleY (float32 1)
+'000000000000F03F' -- scaleY (float64 1)
 ||
-'00000000' -- ipX (float32 0)
+'0000000000000000' -- ipX (float64 0)
 ||
-'00000000' -- ipY (float32 0)
+'0000000000000000' -- ipY (float64 0)
 ||
-'00000000' -- skewX (float32 0)
+'0000000000000000' -- skewX (float64 0)
 ||
-'00000000' -- skewY (float32 0)
+'0000000000000000' -- skewY (float64 0)
 ||
 '0A000000' -- SRID (int32 10)
+|| 
+'0100' -- width (uint16 1)
 ||
-'0100' -- nBands (uint16 1)
+'0100' -- height (uint16 1)
 ||
 '04' -- first band type (8BUI)
 ||
-'00FF' -- 0000.0000 1111.1111 -- novalue==0, pixel(1,1)=255
+'00' -- novalue==0
+||
+'FF' -- pixel(0,0)==255
 ),
 (
 '00' -- big endian (uint8 xdr)
 || 
-'0001' -- width (uint16 1)
+'0000' -- version (uint16 0)
 ||
-'0001' -- height (uint16 1)
+'0001' -- nBands (uint16 1)
 ||
-'3F800000' -- scaleX (float32 1)
+'3FF0000000000000' -- scaleX (float64 1)
 ||
-'3F800000' -- scaleY (float32 1)
+'3FF0000000000000' -- scaleY (float64 1)
 ||
-'00000000' -- ipX (float32 0)
+'0000000000000000' -- ipX (float64 0)
 ||
-'00000000' -- ipY (float32 0)
+'0000000000000000' -- ipY (float64 0)
 ||
-'00000000' -- skewX (float32 0)
+'0000000000000000' -- skewX (float64 0)
 ||
-'00000000' -- skewY (float32 0)
+'0000000000000000' -- skewY (float64 0)
 ||
 '0000000A' -- SRID (int32 10)
 ||
-'0001' -- nBands (uint16 1)
+'0001' -- width (uint16 1)
 ||
+'0001' -- height (uint16 1)
+||
 '04' -- first band type (8BUI)
 ||
-'00FF' -- 0000.0000 1111.1111 -- novalue==0, pixel(1,1)=255
+'00' -- novalue==0
+||
+'FF' -- pixel(0,0)==255
 ) );
 
 -- 1x1, single band of type 16BSI, no transform, scale 1:1
@@ -371,56 +402,64 @@
 (
 '01' -- little endian (uint8 ndr)
 || 
-'0100' -- width (uint16 1)
+'0000' -- version (uint16 0)
 ||
-'0100' -- height (uint16 1)
+'0100' -- nBands (uint16 1)
 ||
-'0000803F' -- scaleX (float32 1)
+'000000000000F03F' -- scaleX (float64 1)
 ||
-'0000803F' -- scaleY (float32 1)
+'000000000000F03F' -- scaleY (float64 1)
 ||
-'00000000' -- ipX (float32 0)
+'0000000000000000' -- ipX (float64 0)
 ||
-'00000000' -- ipY (float32 0)
+'0000000000000000' -- ipY (float64 0)
 ||
-'00000000' -- skewX (float32 0)
+'0000000000000000' -- skewX (float64 0)
 ||
-'00000000' -- skewY (float32 0)
+'0000000000000000' -- skewY (float64 0)
 ||
 '0A000000' -- SRID (int32 10)
+|| 
+'0100' -- width (uint16 1)
 ||
-'0100' -- nBands (uint16 1)
+'0100' -- height (uint16 1)
 ||
 '05' -- first band type (16BSI)
 ||
-'0000FFFF' -- novalue==0, pixel(1,1)=-1
+'0000' -- novalue==0
+||
+'FFFF' -- pixel(0,0)==-1
 ),
 (
 '00' -- big endian (uint8 xdr)
 || 
-'0001' -- width (uint16 1)
+'0000' -- version (uint16 0)
 ||
-'0001' -- height (uint16 1)
+'0001' -- nBands (uint16 1)
 ||
-'3F800000' -- scaleX (float32 1)
+'3FF0000000000000' -- scaleX (float64 1)
 ||
-'3F800000' -- scaleY (float32 1)
+'3FF0000000000000' -- scaleY (float64 1)
 ||
-'00000000' -- ipX (float32 0)
+'0000000000000000' -- ipX (float64 0)
 ||
-'00000000' -- ipY (float32 0)
+'0000000000000000' -- ipY (float64 0)
 ||
-'00000000' -- skewX (float32 0)
+'0000000000000000' -- skewX (float64 0)
 ||
-'00000000' -- skewY (float32 0)
+'0000000000000000' -- skewY (float64 0)
 ||
 '0000000A' -- SRID (int32 10)
 ||
-'0001' -- nBands (uint16 1)
+'0001' -- width (uint16 1)
 ||
+'0001' -- height (uint16 1)
+||
 '05' -- first band type (16BSI)
 ||
-'0000FFFF' -- novalue==0, pixel(1,1)=-1
+'0000' -- novalue==0
+||
+'FFFF' -- pixel(0,0)==-1
 ) );
 
 -- 1x1, single band of type 16BUI, no transform, scale 1:1
@@ -429,56 +468,64 @@
 (
 '01' -- little endian (uint8 ndr)
 || 
-'0100' -- width (uint16 1)
+'0000' -- version (uint16 0)
 ||
-'0100' -- height (uint16 1)
+'0100' -- nBands (uint16 1)
 ||
-'0000803F' -- scaleX (float32 1)
+'000000000000F03F' -- scaleX (float64 1)
 ||
-'0000803F' -- scaleY (float32 1)
+'000000000000F03F' -- scaleY (float64 1)
 ||
-'00000000' -- ipX (float32 0)
+'0000000000000000' -- ipX (float64 0)
 ||
-'00000000' -- ipY (float32 0)
+'0000000000000000' -- ipY (float64 0)
 ||
-'00000000' -- skewX (float32 0)
+'0000000000000000' -- skewX (float64 0)
 ||
-'00000000' -- skewY (float32 0)
+'0000000000000000' -- skewY (float64 0)
 ||
 '0A000000' -- SRID (int32 10)
+|| 
+'0100' -- width (uint16 1)
 ||
-'0100' -- nBands (uint16 1)
+'0100' -- height (uint16 1)
 ||
 '06' -- first band type (16BUI)
 ||
-'0000FFFF' -- novalue==0, pixel(1,1)=65535
+'0000' -- novalue==0
+||
+'FFFF' -- pixel(0,0)==65535
 ),
 (
 '00' -- big endian (uint8 xdr)
 || 
-'0001' -- width (uint16 1)
+'0000' -- version (uint16 0)
 ||
-'0001' -- height (uint16 1)
+'0001' -- nBands (uint16 1)
 ||
-'3F800000' -- scaleX (float32 1)
+'3FF0000000000000' -- scaleX (float64 1)
 ||
-'3F800000' -- scaleY (float32 1)
+'3FF0000000000000' -- scaleY (float64 1)
 ||
-'00000000' -- ipX (float32 0)
+'0000000000000000' -- ipX (float64 0)
 ||
-'00000000' -- ipY (float32 0)
+'0000000000000000' -- ipY (float64 0)
 ||
-'00000000' -- skewX (float32 0)
+'0000000000000000' -- skewX (float64 0)
 ||
-'00000000' -- skewY (float32 0)
+'0000000000000000' -- skewY (float64 0)
 ||
 '0000000A' -- SRID (int32 10)
 ||
-'0001' -- nBands (uint16 1)
+'0001' -- width (uint16 1)
 ||
+'0001' -- height (uint16 1)
+||
 '06' -- first band type (16BUI)
 ||
-'0000FFFF' -- novalue==0, pixel(1,1)=65535
+'0000' -- novalue==0
+||
+'FFFF' -- pixel(0,0)==65535
 ) );
 
 -- 1x1, single band of type 32BSI, no transform, scale 1:1
@@ -487,56 +534,64 @@
 (
 '01' -- little endian (uint8 ndr)
 || 
-'0100' -- width (uint16 1)
+'0000' -- version (uint16 0)
 ||
-'0100' -- height (uint16 1)
+'0100' -- nBands (uint16 1)
 ||
-'0000803F' -- scaleX (float32 1)
+'000000000000F03F' -- scaleX (float64 1)
 ||
-'0000803F' -- scaleY (float32 1)
+'000000000000F03F' -- scaleY (float64 1)
 ||
-'00000000' -- ipX (float32 0)
+'0000000000000000' -- ipX (float64 0)
 ||
-'00000000' -- ipY (float32 0)
+'0000000000000000' -- ipY (float64 0)
 ||
-'00000000' -- skewX (float32 0)
+'0000000000000000' -- skewX (float64 0)
 ||
-'00000000' -- skewY (float32 0)
+'0000000000000000' -- skewY (float64 0)
 ||
 '0A000000' -- SRID (int32 10)
+|| 
+'0100' -- width (uint16 1)
 ||
-'0100' -- nBands (uint16 1)
+'0100' -- height (uint16 1)
 ||
 '07' -- first band type (32BSI)
 ||
-'00000000FFFFFFFF' -- novalue==0, pixel(1,1)=-1
+'00000000' -- novalue==0
+||
+'FFFFFFFF' -- pixel(0,0)==-1 ?
 ),
 (
 '00' -- big endian (uint8 xdr)
 || 
-'0001' -- width (uint16 1)
+'0000' -- version (uint16 0)
 ||
-'0001' -- height (uint16 1)
+'0001' -- nBands (uint16 1)
 ||
-'3F800000' -- scaleX (float32 1)
+'3FF0000000000000' -- scaleX (float64 1)
 ||
-'3F800000' -- scaleY (float32 1)
+'3FF0000000000000' -- scaleY (float64 1)
 ||
-'00000000' -- ipX (float32 0)
+'0000000000000000' -- ipX (float64 0)
 ||
-'00000000' -- ipY (float32 0)
+'0000000000000000' -- ipY (float64 0)
 ||
-'00000000' -- skewX (float32 0)
+'0000000000000000' -- skewX (float64 0)
 ||
-'00000000' -- skewY (float32 0)
+'0000000000000000' -- skewY (float64 0)
 ||
 '0000000A' -- SRID (int32 10)
 ||
-'0001' -- nBands (uint16 1)
+'0001' -- width (uint16 1)
 ||
+'0001' -- height (uint16 1)
+||
 '07' -- first band type (32BSI)
 ||
-'00000000FFFFFFFF' -- novalue==0, pixel(1,1)=-1
+'00000000' -- novalue==0
+||
+'FFFFFFFF' -- pixel(0,0)==-1 ? 
 ) );
 
 -- 1x1, single band of type 32BUI, no transform, scale 1:1
@@ -545,179 +600,339 @@
 (
 '01' -- little endian (uint8 ndr)
 || 
-'0100' -- width (uint16 1)
+'0000' -- version (uint16 0)
 ||
-'0100' -- height (uint16 1)
+'0100' -- nBands (uint16 1)
 ||
-'0000803F' -- scaleX (float32 1)
+'000000000000F03F' -- scaleX (float64 1)
 ||
-'0000803F' -- scaleY (float32 1)
+'000000000000F03F' -- scaleY (float64 1)
 ||
-'00000000' -- ipX (float32 0)
+'0000000000000000' -- ipX (float64 0)
 ||
-'00000000' -- ipY (float32 0)
+'0000000000000000' -- ipY (float64 0)
 ||
-'00000000' -- skewX (float32 0)
+'0000000000000000' -- skewX (float64 0)
 ||
-'00000000' -- skewY (float32 0)
+'0000000000000000' -- skewY (float64 0)
 ||
 '0A000000' -- SRID (int32 10)
+|| 
+'0100' -- width (uint16 1)
 ||
-'0100' -- nBands (uint16 1)
+'0100' -- height (uint16 1)
 ||
 '08' -- first band type (32BUI)
 ||
-'00000000FFFFFFFF' -- novalue==0, pixel(1,1)=4294967295
+'00000000' -- novalue==0
+||
+'FFFFFFFF' -- pixel(0,0)=4294967295
 ),
 (
 '00' -- big endian (uint8 xdr)
 || 
-'0001' -- width (uint16 1)
+'0000' -- version (uint16 0)
 ||
-'0001' -- height (uint16 1)
+'0001' -- nBands (uint16 1)
 ||
-'3F800000' -- scaleX (float32 1)
+'3FF0000000000000' -- scaleX (float64 1)
 ||
-'3F800000' -- scaleY (float32 1)
+'3FF0000000000000' -- scaleY (float64 1)
 ||
-'00000000' -- ipX (float32 0)
+'0000000000000000' -- ipX (float64 0)
 ||
-'00000000' -- ipY (float32 0)
+'0000000000000000' -- ipY (float64 0)
 ||
-'00000000' -- skewX (float32 0)
+'0000000000000000' -- skewX (float64 0)
 ||
-'00000000' -- skewY (float32 0)
+'0000000000000000' -- skewY (float64 0)
 ||
 '0000000A' -- SRID (int32 10)
 ||
-'0001' -- nBands (uint16 1)
+'0001' -- width (uint16 1)
 ||
+'0001' -- height (uint16 1)
+||
 '08' -- first band type (32BUI)
 ||
-'00000000FFFFFFFF' -- novalue==0, pixel(1,1)=4294967295
+'00000000' -- novalue==0
+||
+'FFFFFFFF' -- pixel(0,0)=4294967295
 ) );
 
+#if 0 /* 16BF pixeltype not supported yet */
 -- 1x1, single band of type 16BF, no transform, scale 1:1
 INSERT INTO rt_test (id, name, hexwkb_ndr, hexwkb_xdr)
 VALUES ( 10, '1x1 single band (16BF) no transform',
 (
 '01' -- little endian (uint8 ndr)
 || 
-'0100' -- width (uint16 1)
+'0000' -- version (uint16 0)
 ||
-'0100' -- height (uint16 1)
+'0100' -- nBands (uint16 1)
 ||
-'0000803F' -- scaleX (float32 1)
+'000000000000F03F' -- scaleX (float64 1)
 ||
-'0000803F' -- scaleY (float32 1)
+'000000000000F03F' -- scaleY (float64 1)
 ||
-'00000000' -- ipX (float32 0)
+'0000000000000000' -- ipX (float64 0)
 ||
-'00000000' -- ipY (float32 0)
+'0000000000000000' -- ipY (float64 0)
 ||
-'00000000' -- skewX (float32 0)
+'0000000000000000' -- skewX (float64 0)
 ||
-'00000000' -- skewY (float32 0)
+'0000000000000000' -- skewY (float64 0)
 ||
 '0A000000' -- SRID (int32 10)
+|| 
+'0100' -- width (uint16 1)
 ||
-'0100' -- nBands (uint16 1)
+'0100' -- height (uint16 1)
 ||
 '09' -- first band type (16BF)
 ||
-'0000'||'8C3F' -- novalue==0, pixel(1,1)=??
+'0000' -- novalue==0
+||
+'FFFF' -- pixel(0,0)=?
 ),
 (
 '00' -- big endian (uint8 xdr)
 || 
-'0001' -- width (uint16 1)
+'0000' -- version (uint16 0)
 ||
-'0001' -- height (uint16 1)
+'0001' -- nBands (uint16 1)
 ||
-'3F800000' -- scaleX (float32 1)
+'3FF0000000000000' -- scaleX (float64 1)
 ||
-'3F800000' -- scaleY (float32 1)
+'3FF0000000000000' -- scaleY (float64 1)
 ||
-'00000000' -- ipX (float32 0)
+'0000000000000000' -- ipX (float64 0)
 ||
-'00000000' -- ipY (float32 0)
+'0000000000000000' -- ipY (float64 0)
 ||
-'00000000' -- skewX (float32 0)
+'0000000000000000' -- skewX (float64 0)
 ||
-'00000000' -- skewY (float32 0)
+'0000000000000000' -- skewY (float64 0)
 ||
 '0000000A' -- SRID (int32 10)
 ||
-'0001' -- nBands (uint16 1)
+'0001' -- width (uint16 1)
 ||
+'0001' -- height (uint16 1)
+||
 '09' -- first band type (16BF)
 ||
-'0000'||'3F8C' -- novalue==0, pixel(1,1)=??
+'0000' -- novalue==0
+||
+'FFFF' -- pixel(0,0)=?
 ) );
 
+#endif /* 16BF pixeltype not supported yet */
+
 -- 1x1, single band of type 32BF, no transform, scale 1:1
 INSERT INTO rt_test (id, name, hexwkb_ndr, hexwkb_xdr)
 VALUES ( 11, '1x1 single band (32BF) no transform',
 (
 '01' -- little endian (uint8 ndr)
 || 
+'0000' -- version (uint16 0)
+||
+'0100' -- nBands (uint16 1)
+||
+'000000000000F03F' -- scaleX (float64 1)
+||
+'000000000000F03F' -- scaleY (float64 1)
+||
+'0000000000000000' -- ipX (float64 0)
+||
+'0000000000000000' -- ipY (float64 0)
+||
+'0000000000000000' -- skewX (float64 0)
+||
+'0000000000000000' -- skewY (float64 0)
+||
+'0A000000' -- SRID (int32 10)
+|| 
 '0100' -- width (uint16 1)
 ||
 '0100' -- height (uint16 1)
 ||
-'0000803F' -- scaleX (float32 1)
+'0A' -- first band type (32BF)
 ||
-'0000803F' -- scaleY (float32 1)
+'00000000' -- novalue==0
 ||
-'00000000' -- ipX (float32 0)
+'CDCC8C3F' -- pixel(0,0)=1.1
+),
+(
+'00' -- big endian (uint8 xdr)
+|| 
+'0000' -- version (uint16 0)
 ||
-'00000000' -- ipY (float32 0)
+'0001' -- nBands (uint16 1)
 ||
-'00000000' -- skewX (float32 0)
+'3FF0000000000000' -- scaleX (float64 1)
 ||
-'00000000' -- skewY (float32 0)
+'3FF0000000000000' -- scaleY (float64 1)
 ||
-'0A000000' -- SRID (int32 10)
+'0000000000000000' -- ipX (float64 0)
 ||
+'0000000000000000' -- ipY (float64 0)
+||
+'0000000000000000' -- skewX (float64 0)
+||
+'0000000000000000' -- skewY (float64 0)
+||
+'0000000A' -- SRID (int32 10)
+||
+'0001' -- width (uint16 1)
+||
+'0001' -- height (uint16 1)
+||
+'0A' -- first band type (32BF)
+||
+'00000000' -- novalue==0
+||
+'3F8CCCCD' -- pixel(0,0)=1.1
+) );
+
+-- 1x1, single band of type 64BF, no transform, scale 1:1
+INSERT INTO rt_test (id, name, hexwkb_ndr, hexwkb_xdr)
+VALUES ( 11, '1x1 single band (64BF) no transform',
+(
+'01' -- little endian (uint8 ndr)
+|| 
+'0000' -- version (uint16 0)
+||
 '0100' -- nBands (uint16 1)
 ||
+'000000000000F03F' -- scaleX (float64 1)
+||
+'000000000000F03F' -- scaleY (float64 1)
+||
+'0000000000000000' -- ipX (float64 0)
+||
+'0000000000000000' -- ipY (float64 0)
+||
+'0000000000000000' -- skewX (float64 0)
+||
+'0000000000000000' -- skewY (float64 0)
+||
+'0A000000' -- SRID (int32 10)
+|| 
+'0100' -- width (uint16 1)
+||
+'0100' -- height (uint16 1)
+||
 '0B' -- first band type (64BF)
 ||
-'0000000000000000'||'AE47E17A14AE1540' -- novalue==0, pixel(1,1)=5.42
+'0000000000000000' -- novalue==0
+||
+'AE47E17A14AE1540' -- pixel(0,0)=5.42
 ),
 (
 '00' -- big endian (uint8 xdr)
 || 
+'0000' -- version (uint16 0)
+||
+'0001' -- nBands (uint16 1)
+||
+'3FF0000000000000' -- scaleX (float64 1)
+||
+'3FF0000000000000' -- scaleY (float64 1)
+||
+'0000000000000000' -- ipX (float64 0)
+||
+'0000000000000000' -- ipY (float64 0)
+||
+'0000000000000000' -- skewX (float64 0)
+||
+'0000000000000000' -- skewY (float64 0)
+||
+'0000000A' -- SRID (int32 10)
+||
 '0001' -- width (uint16 1)
 ||
 '0001' -- height (uint16 1)
 ||
-'3F800000' -- scaleX (float32 1)
+'0B' -- first band type (64BF)
 ||
-'3F800000' -- scaleY (float32 1)
+'0000000000000000' -- novalue==0
 ||
-'00000000' -- ipX (float32 0)
+'4015AE147AE147AE' -- pixel(0,0)=5.42
+) );
+
+-- 1x1, single band of type 64BF (external: 3:/tmp/t.tif),
+-- no transform, scale 1:1
+--
+INSERT INTO rt_test (id, name, hexwkb_ndr, hexwkb_xdr)
+VALUES ( 12, '1x1 single band (64BF external) no transform',
+(
+'01' -- little endian (uint8 ndr)
+|| 
+'0000' -- version (uint16 0)
 ||
-'00000000' -- ipY (float32 0)
+'0100' -- nBands (uint16 1)
 ||
-'00000000' -- skewX (float32 0)
+'000000000000F03F' -- scaleX (float64 1)
 ||
-'00000000' -- skewY (float32 0)
+'000000000000F03F' -- scaleY (float64 1)
 ||
-'0000000A' -- SRID (int32 10)
+'0000000000000000' -- ipX (float64 0)
 ||
+'0000000000000000' -- ipY (float64 0)
+||
+'0000000000000000' -- skewX (float64 0)
+||
+'0000000000000000' -- skewY (float64 0)
+||
+'0A000000' -- SRID (int32 10)
+|| 
+'0100' -- width (uint16 1)
+||
+'0100' -- height (uint16 1)
+||
+'8B' -- first band type (64BF + ext flag)
+||
+'0000000000000000' -- novalue==0
+||
+'03' -- ext band num == 3
+||
+'2F746D702F742E74696600' -- "/tmp/t.tif"
+),
+(
+'00' -- big endian (uint8 xdr)
+|| 
+'0000' -- version (uint16 0)
+||
 '0001' -- nBands (uint16 1)
 ||
-'0B' -- first band type (64BF)
+'3FF0000000000000' -- scaleX (float64 1)
 ||
-'0000000000000000'||'4015AE147AE147AE' -- novalue==0, pixel(1,1)=5.42
+'3FF0000000000000' -- scaleY (float64 1)
+||
+'0000000000000000' -- ipX (float64 0)
+||
+'0000000000000000' -- ipY (float64 0)
+||
+'0000000000000000' -- skewX (float64 0)
+||
+'0000000000000000' -- skewY (float64 0)
+||
+'0000000A' -- SRID (int32 10)
+||
+'0001' -- width (uint16 1)
+||
+'0001' -- height (uint16 1)
+||
+'8B' -- first band type (64BF)
+||
+'0000000000000000' -- novalue==0
+||
+'03' -- ext band num == 3
+||
+'2F746D702F742E74696600' -- "/tmp/t.tif"
 ) );
 
-#endif
-
--- TODO:
--- * EXT
-
 SELECT name,
     hexwkb_ndr::raster::text = hexwkb_ndr as ndr_io, 
     hexwkb_xdr::raster::text = hexwkb_ndr as xdr_io



More information about the postgis-commits mailing list