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.

• Well Known Binary Well Known Binary (WKB) refers to the binary <strong>for</strong>m <strong>of</strong> the Well Known<br />

Text described above. It is used when inserting a raster using ST_<strong>Raster</strong>FromWKB() (not yet<br />

implemented) and retrieving a raster using ST_AsBinary().<br />

Example:<br />

SELECT ST_AsBinary(rast) As rastbin<br />

FROM dummy_rast WHERE rid=1;<br />

rastbin<br />

-------------------------------------------------------------------------------<br />

0010000000000000000000000000000000000000000000000000000100000000000000000003400<br />

0000000000000000034000000000000000000000000000000000000000000000000001200000000<br />

0012000024000<br />

• Hexadecimal WKB Hexadecimal WKB (HEXWKB) is a hexadecimal representation <strong>of</strong> the WKB<br />

<strong>for</strong>m. This <strong>for</strong>m is used by the Python loader raster2pgsql.py and when outputting the value<br />

<strong>of</strong> a raster field like SELECT rast FROM raster_table.<br />

Example:<br />

SELECT rast from dummy_rast WHERE rid = 2;<br />

---------------------------------------------------------------------------------<br />

01000003009A9999999999A93F9A9999999999A9BF000000E02B274A4100000000771956410000000<br />

0000000000000000000000000FFFFFFFF050005000400FDFEFDFEFEFDFEFEFDF9FAFEFEFCF9FBFDFE<br />

FEFDFCFAFEFEFE04004E627AADD16076B4F9FE6370A9F5FE59637AB0E54F58617087040046566487A<br />

1506CA2E3FA5A6CAFFBFE4D566DA4CB3E454C5665<br />

4.15 Physical Storage<br />

<strong>PostGIS</strong> <strong>Raster</strong> enables user to store raster images in the database (storing in-database raster)<br />

or merely register them as external files (registering out-database raster). When registering a raster,<br />

only the raster metadata (width, height, number <strong>of</strong> band, georeference and path to the actual raster<br />

file) are stored in the database and not the pixel values.<br />

4.15.1 Storing In-database <strong>Raster</strong> Versus Storing Out-database <strong>Raster</strong><br />

<strong>The</strong> choice made between out-database raster and in-database raster depends on user applications.<br />

When user applications are read-only applications, that means that they only retrieve data and do<br />

not prefer to modify data. Out-database raster storage facilitates these processes by providing:<br />

• Fast application access: storing out-database raster stores the path <strong>of</strong> the raster image file<br />

conserved in the filesystem. It can speed up the reading <strong>of</strong> rasters files (JPEG, GIF, PNG) <strong>for</strong><br />

web applications in the way that only the path is needed to read when retrieving raster data<br />

and there is no need to convert it from the <strong>PostGIS</strong> <strong>Raster</strong> type to an image file.<br />

• Fast loading database: in the first time <strong>of</strong> loading a raster coverage (a table that contains<br />

a colon <strong>of</strong> type out-database raster or in-database raster), it is executed faster than normally<br />

since only the raster metadata has to be loaded or copied from the database.<br />

• Applicable SQL operators and functions: all operators and functions, that are available <strong>for</strong><br />

in-database raster data (except those involving write operations to the raster data like setting<br />

pixel value), work also with out-database rasters.<br />

49

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

Saved successfully!

Ooh no, something went wrong!