[postgis-commits] svn - r3613 - spike/wktraster/rt_core
postgis-commits at postgis.refractions.net
postgis-commits at postgis.refractions.net
Mon Feb 2 09:27:14 PST 2009
Author: strk
Date: 2009-02-02 09:27:13 -0800 (Mon, 02 Feb 2009)
New Revision: 3613
Modified:
spike/wktraster/rt_core/rt_api.c
Log:
Don't forget to register actual bands on deserialization
Modified: spike/wktraster/rt_core/rt_api.c
===================================================================
--- spike/wktraster/rt_core/rt_api.c 2009-02-02 17:16:00 UTC (rev 3612)
+++ spike/wktraster/rt_core/rt_api.c 2009-02-02 17:27:13 UTC (rev 3613)
@@ -1810,7 +1810,9 @@
for (i=0; i<rast->numBands; ++i)
{
+#ifdef RT_API_DEBUG
ctx->info("Parsing band %d from wkb", i);
+#endif
rt_band band = rt_band_from_wkb(ctx, rast->width, rast->height,
&ptr, wkbend, endian);
if ( ! band )
@@ -1879,12 +1881,22 @@
uint32_t size = RT_WKB_HDR_SZ;
uint16_t i;
+#ifdef RT_API_DEBUG
+ ctx->info("rt_raster_wkb_size: computing size for %d bands",
+ raster->numBands);
+#endif
+
for (i=0; i<raster->numBands; ++i)
{
rt_band band = raster->bands[i];
rt_pixtype pixtype = band->pixtype;
int pixbytes = rt_pixtype_size(ctx, pixtype);
+#ifdef RT_API_DEBUG
+ ctx->info("rt_raster_wkb_size: adding size of band %d",
+ i);
+#endif
+
if ( pixbytes < 1 ) {
// ERROR !
ctx->err("Corrupted band: unkonwn pixtype");
@@ -1923,7 +1935,14 @@
uint16_t i;
uint8_t littleEndian = isMachineLittleEndian();
+#ifdef RT_API_DEBUG
+ ctx->info("rt_raster_to_wkb: about to call rt_raster_wkb_size");
+#endif
*wkbsize = rt_raster_wkb_size(ctx, raster);
+#ifdef RT_API_DEBUG
+ ctx->info("rt_raster_to_wkb: found size:%d", *wkbsize);
+#endif
+
wkb = (uint8_t*)ctx->alloc(*wkbsize);
if ( ! wkb )
{
@@ -2076,7 +2095,9 @@
uint32_t i;
uint32_t wkbsize;
+ ctx->info("rt_rater_to_hexwkb: calling rt_raster_to_wkb");
wkb = rt_raster_to_wkb(ctx, raster, &wkbsize);
+ ctx->info("rt_rater_to_hexwkb: rt_raster_to_wkb returned");
*hexwkbsize = wkbsize*2; /* hex is 2 times bytes */
hexwkb = (char*)ctx->alloc( (*hexwkbsize)+1);
@@ -2333,6 +2354,8 @@
return 0;
}
+ rast->bands[i] = band;
+
type = *ptr; ptr++;
band->pixtype = type&BANDTYPE_PIXTYPE_MASK;
band->offline = BANDTYPE_IS_OFFDB(type) ? 1 : 0;
More information about the postgis-commits
mailing list