| 1 | RFC2: Well Known Binary format for RASTER type |
|---|
| 2 | ---------------------------------------------- |
|---|
| 3 | $Author$ |
|---|
| 4 | $Date$ |
|---|
| 5 | $Revision$ |
|---|
| 6 | ------------------------------------------------------ |
|---|
| 7 | |
|---|
| 8 | The WKB format for RASTER is meant for transport. |
|---|
| 9 | Takes into account endiannes and avoids any padding. |
|---|
| 10 | Still, beside padding and endiannes, it matches the |
|---|
| 11 | internal serialized format (see RFC1), for quick |
|---|
| 12 | input/output. |
|---|
| 13 | |
|---|
| 14 | // Basic Type definitions |
|---|
| 15 | // byte : 1 byte |
|---|
| 16 | // uint16 : 16 bit unsigned integer (2 bytes) |
|---|
| 17 | // uint32 : 32 bit unsigned integer (4 bytes) |
|---|
| 18 | // float64 : double precision floating point number (8 bytes) |
|---|
| 19 | |
|---|
| 20 | +------------------------------------------------------------+ |
|---|
| 21 | | RASTER | |
|---|
| 22 | +---------------+-------------+------------------------------+ |
|---|
| 23 | | - name - | - type - | - meaning - | |
|---|
| 24 | +---------------+-------------+------------------------------+ |
|---|
| 25 | | endiannes | byte | 1:ndr/little endian | |
|---|
| 26 | | | | 0:xdr/big endian | |
|---|
| 27 | +---------------+-------------+------------------------------+ |
|---|
| 28 | | version | uint16 | format version (0 for this | |
|---|
| 29 | | | | structure) | |
|---|
| 30 | +---------------+-------------+------------------------------+ |
|---|
| 31 | | nBands | uint16 | Number of bands | |
|---|
| 32 | +---------------+-------------+------------------------------+ |
|---|
| 33 | | scaleX | float64 | pixel width | |
|---|
| 34 | | | | in geographical units | |
|---|
| 35 | +---------------+-------------+------------------------------+ |
|---|
| 36 | | scaleY | float64 | pixel height | |
|---|
| 37 | | | | in geographical units | |
|---|
| 38 | +---------------+-------------+------------------------------+ |
|---|
| 39 | | ipX | float64 | X ordinate of upper-left | |
|---|
| 40 | | | | pixel's upper-left corner | |
|---|
| 41 | | | | in geographical units | |
|---|
| 42 | +---------------+-------------+------------------------------+ |
|---|
| 43 | | ipY | float64 | Y ordinate of upper-left | |
|---|
| 44 | | | | pixel's upper-left corner | |
|---|
| 45 | | | | in geographical units | |
|---|
| 46 | +---------------+-------------+------------------------------+ |
|---|
| 47 | | skewX | float64 | rotation about Y-axis | |
|---|
| 48 | +---------------+-------------+------------------------------+ |
|---|
| 49 | | skewY | float64 | rotation about X-axis | |
|---|
| 50 | +---------------+-------------+------------------------------+ |
|---|
| 51 | | srid | int32 | Spatial reference id | |
|---|
| 52 | +---------------+-------------+------------------------------+ |
|---|
| 53 | | width | uint16 | number of pixel columns | |
|---|
| 54 | +---------------+-------------+------------------------------+ |
|---|
| 55 | | height | uint16 | number of pixel rows | |
|---|
| 56 | +---------------+-------------+------------------------------+ |
|---|
| 57 | | bands[nBands] | RASTERBAND | Bands data | |
|---|
| 58 | +---------------+-------------+------------------------------+ |
|---|
| 59 | |
|---|
| 60 | |
|---|
| 61 | +------------------------------------------------------------------+ |
|---|
| 62 | | RASTERBAND | |
|---|
| 63 | +---------------+--------------+-----------------------------------+ |
|---|
| 64 | | - name - | - type - | - meaning - | |
|---|
| 65 | +---------------+--------------+-----------------------------------+ |
|---|
| 66 | | isOffline | 1bit | If true, data is to be found | |
|---|
| 67 | | | | on the filesystem, trought the | |
|---|
| 68 | | | | path specified in RASTERDATA | |
|---|
| 69 | +---------------+--------------+-----------------------------------+ |
|---|
| 70 | | hasNodataValue| 1bit | If true, stored nodata value is | |
|---|
| 71 | | | | a true nodata value. Otherwise | |
|---|
| 72 | | | | the value stored as a nodata | |
|---|
| 73 | | | | value should be ignored. | |
|---|
| 74 | +---------------+--------------+-----------------------------------+ |
|---|
| 75 | | reserved | 2bits | unused in this version | |
|---|
| 76 | +---------------+--------------+-----------------------------------+ |
|---|
| 77 | | pixtype | 4bits | 0: 1-bit boolean | |
|---|
| 78 | | | | 1: 2-bit unsigned integer | |
|---|
| 79 | | | | 2: 4-bit unsigned integer | |
|---|
| 80 | | | | 3: 8-bit signed integer | |
|---|
| 81 | | | | 4: 8-bit unsigned integer | |
|---|
| 82 | | | | 5: 16-bit signed integer | |
|---|
| 83 | | | | 6: 16-bit unsigned signed integer | |
|---|
| 84 | | | | 7: 32-bit signed integer | |
|---|
| 85 | | | | 8: 32-bit unsigned signed integer | |
|---|
| 86 | | | | 9: 32-bit float | |
|---|
| 87 | | | | 10: 64-bit float | |
|---|
| 88 | +---------------+--------------+-----------------------------------+ |
|---|
| 89 | | nodata | 1 to 8 bytes | Nodata value | |
|---|
| 90 | | | depending on | | |
|---|
| 91 | | | pixtype [1] | | |
|---|
| 92 | +---------------+--------------+-----------------------------------+ |
|---|
| 93 | | data | RASTERDATA | Raster band data (see below) | |
|---|
| 94 | +---------------+--------------+-----------------------------------+ |
|---|
| 95 | |
|---|
| 96 | +------------------------------------------------------------------+ |
|---|
| 97 | | RASTERDATA (isOffline flag clear) | |
|---|
| 98 | +---------------+--------------+-----------------------------------+ |
|---|
| 99 | | pix[w*h] | 1 to 8 bytes | Pixels values, row after row, | |
|---|
| 100 | | | depending on | so pix[0] is upper-left, pix[w-1] | |
|---|
| 101 | | | pixtype [1] | is upper-right. | |
|---|
| 102 | | | | | |
|---|
| 103 | | | | As for endiannes, it is specified | |
|---|
| 104 | | | | at the start of WKB, and implicit | |
|---|
| 105 | | | | up to 8bits (bit-order is most | |
|---|
| 106 | | | | significant first) | |
|---|
| 107 | | | | | |
|---|
| 108 | +---------------+--------------+-----------------------------------+ |
|---|
| 109 | |
|---|
| 110 | [1] 1,2 and 4 bit pixtypes are still encoded as 1-byte per value |
|---|
| 111 | |
|---|
| 112 | +-----------------------------------------------------------------+ |
|---|
| 113 | | RASTERDATA (isOffline flag set) | |
|---|
| 114 | +---------------+-------------+-----------------------------------+ |
|---|
| 115 | | bandNumber | int8 | 0-based band number to use from | |
|---|
| 116 | | | | the set available in the external | |
|---|
| 117 | | | | file | |
|---|
| 118 | +---------------+-------------+-----------------------------------+ |
|---|
| 119 | | path | string | null-terminated path to data file | |
|---|
| 120 | +---------------+-------------+-----------------------------------+ |
|---|