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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Figure 4.42: Web application with out-database raster [23].<br />

• Simplified backup: since raster images in the filesystem that is not expected to be edited<br />

and only its metadata is registered in the database, in this way, out-database storage can avoid<br />

useless database backup <strong>of</strong> large data.<br />

In contrast, the traditional in-database raster is related to editing and analysis applications because<br />

<strong>of</strong> the following advantages:<br />

• Fast analysis: analysis operations per<strong>for</strong>med on raster data (such as dum a raster as polygons<br />

using ST_AsPolygon(), find intersection between raster and vector/raster with ST_Intersections()<br />

and etc.) require working on pixel values. <strong>The</strong> structure <strong>of</strong> raster data is nothing else a grid<br />

<strong>of</strong> two dimensions <strong>of</strong> cells, where value <strong>of</strong> each cell represents value <strong>of</strong> the corresponding pixel.<br />

Obviously, execution time <strong>of</strong> these operations is faster on in-database rasters since there is no<br />

need to extract the pixel values from an image file <strong>of</strong> JPEG or TIFF <strong>for</strong>mat.<br />

• Single storage: no matter what if data belongs to raster or vector type, <strong>PostGIS</strong> <strong>Raster</strong> allows<br />

a single dataset storage. <strong>The</strong>re is no need to store the raster data separately from the vector<br />

data, they can be placed alternatively in the same dataset.<br />

• Multi-Users edition: multiple users can modify raster data at the same time as <strong>PostGIS</strong><br />

database handles concurrent editing on in-database rasters.<br />

4.15.2 Registering Out-database <strong>Raster</strong><br />

Registering out-database raster is done via the -R option when loading raster image file into<br />

database.<br />

Example:<br />

python raster2pgsql.py -r c:/imagesets/landsat/image.tif -t landsat -R<br />

Where the key option -r specifies the input raster image, the -t option specifies the name <strong>of</strong><br />

rater table that contains the corresponding raster and the -R option indicates that the raster image<br />

is registered as a filesystem.<br />

4.15.3 Storing In-database <strong>Raster</strong><br />

Like geometry type, raster type is a complex <strong>PostgreSQL</strong> type composed <strong>of</strong> many attributes. A<br />

raster attribute may be composed <strong>of</strong> many bands having a common size, pixel size and georeference.<br />

Besides this, additional in<strong>for</strong>mation is needed to interpret the image data, such as a pixel type and<br />

a nodata value. <strong>The</strong> storage used <strong>for</strong> raster bands is band sequential (BSQ), which is one <strong>of</strong> three<br />

primary methods <strong>for</strong> encoding image data <strong>for</strong> multiband raster images. BSQ is not itself an image<br />

<strong>for</strong>mat but is a method <strong>for</strong> encoding pixel values <strong>of</strong> an image, where each line <strong>of</strong> the data is followed<br />

immediately by the next line in the same band. <strong>The</strong> BSQ data organization is optimal <strong>for</strong> spatial<br />

50

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

Saved successfully!

Ooh no, something went wrong!