[postgis-devel] questions about wktraster

strk strk at keybit.net
Tue Mar 3 00:03:57 PST 2009


On Tue, Mar 03, 2009 at 09:41:07AM +0800, xie_jiong wrote:
>    Thanks, it means serialized format needn't consider endian, but in the code: 
> 
> when rt_raster_serialize, we just memcpy nodata value to serialized ptr,such as: 
>             case PT_16BSI:
>             case PT_16BUI:
>             {
>                 uint16_t v = band->nodataval;
>                 memcpy(ptr, &v, 2); ptr+=2;
>                 break;
>             }
> 
>     but when rt_raster_deserialize, we must consider Endian when read nodata value, such as
>           case PT_16BSI:
>           {
>                band->nodataval = read_int16(&ptr, littleEndian);
>                break;
>           }
>    Why?

That's just for convenience of reusing existing functions.
We store 'nodataval' in memory as a double, but could be
of any size in the serialized format. 

--strk;



More information about the postgis-devel mailing list