13.07.2013 Views

PostGIS Raster : Extending PostgreSQL for The Support of ... - CoDE

PostGIS Raster : Extending PostgreSQL for The Support of ... - CoDE

PostGIS Raster : Extending PostgreSQL for The Support of ... - CoDE

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

In this example, the dummy_rast table has two rows. Each <strong>of</strong> them corresponds to a raster tile.<br />

When inserting raster data <strong>for</strong> the first row, the first byte 01 is used to define the order <strong>of</strong> bytes<br />

organized in memory, called endianness. If it is a little endian, a computer records 0xA0B70708<br />

in the order 08 07 B7 A0 with the byte lowest first. <strong>The</strong> rest specifies different components <strong>of</strong> raster<br />

attribute like version, number band, scale, pixel size, skew, SRID, with and height. Each <strong>of</strong> them is<br />

separated from each other by a double vertical bar ’||’. However, it is not always in this way, like the<br />

one in the second row. <strong>The</strong> ’||’ can be placed anywhere in the whole hexadecimal string. As the first<br />

raster tile has no band, there is no string <strong>for</strong> band data values.<br />

In contrast, more invisibly, raster data in the second row is composed <strong>of</strong> three long strings but they<br />

can be decomposed into small strings according to structure <strong>of</strong> a raster type. Such a decomposition<br />

splits the first byte <strong>for</strong> ’endianness’, the next two bytes <strong>for</strong> ’version’ and etc. Or, data in the second<br />

raster tile can be rewritten in the following way:<br />

01 -- little endian<br />

00 00 -- version (uint16 0)<br />

03 00 -- nBands (uint16 3)<br />

--Georeference in<strong>for</strong>mation<br />

9A 99 99 99 99 99 A9 3F -- scale X (float64 0.05)<br />

9A 99 99 99 99 99 A9 BF -- scale Y (float64 -0.05)<br />

00 00 00 E0 2B 27 4A 41 -- ipX (float64 3427927.75)<br />

00 00 00 00 77 19 56 41 -- ipY (float64 5793244)<br />

00 00 00 00 00 00 00 00 -- skewX (float64 0)<br />

00 00 00 00 00 00 00 00 -- skew Y (float64 0)<br />

FF FF FF FF -- SRID (int32 -1)<br />

05 00 -- width (uint16 5)<br />

05 00 -- height (uint16 5)<br />

--Band in<strong>for</strong>mation<br />

--Band 1<br />

0 -- is<strong>of</strong>fline, hasnodatavalue (no is<strong>of</strong>fline, no nodatavalue )<br />

4 -- pixeltype (4 bit 8_BUI)<br />

00 -- nodata value<br />

--Band data values 5x5 pixels<br />

FD FE FD FE FE<br />

FD FE FE FD F9<br />

FA FE FE FC F9<br />

FB FD FE FE FD<br />

FC FA FE FE FE<br />

--Band 2<br />

0400 --<br />

--Band data values 5x5 pixels<br />

4E 62 7A AD D1<br />

60 76 B4 F9 FE<br />

63 70 A9 F5 FE<br />

59 63 7A B0 E5<br />

4F 58 61 70 87<br />

--Band 3<br />

04 00<br />

--Band data values 5x5 pixels<br />

46 56 64 87 A1<br />

50 6C A2 E3 FA<br />

5A 6C AF FB FE<br />

4D 56 6D A4 CB<br />

3E 45 4C 56 65<br />

As shown in Figure 4.44, the raster data stored in the second row <strong>of</strong> dummy_rast table can be<br />

52

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!