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.

FROM buff_temp<br />

GROUP BY id<br />

ORDER BY id;<br />

5.8 Aggregate Functions<br />

Figure 5.7: Different temperature values in a polygon [23].<br />

<strong>The</strong> ST_Union(rast, band, expression) function returns a single band raster from the union<br />

<strong>of</strong> a set <strong>of</strong> raster tiles. If no band is specified <strong>for</strong> the union, band number 1 is assumed. <strong>The</strong><br />

resulting raster’s extent is the extent <strong>of</strong> the whole set. <strong>The</strong> resulting raster pixel values are defined by<br />

expression parameter. User can define their own expressions or use predefined functions like FIRST,<br />

LAST, MIN, MAX, SUM, MEAN and COUNT. <strong>The</strong> default function is LAST when no expression<br />

is specified. <strong>The</strong> LAST (respectively FIRST) function merges all rasters together by unioning their<br />

extents and burning the last (first) raster without taking the other raster pixel values into account.<br />

SELECT (ST_Union(rast, ’last’)<br />

FROM dummy_rast;<br />

5.9 Create a High Resolution Analysis Grid<br />

Even though, to compute road and river length, mean temperature and etc, a vector <strong>for</strong>mat can<br />

be used to store each cell <strong>of</strong> a grid as a polygon. <strong>The</strong>n necessaire operations are applied to the set<br />

<strong>of</strong> polygons. It sounds like raisonnable but with a huge set <strong>of</strong> polygon (500 000 x 300 000 polygons)<br />

resulting from a large area, these polygons are unmanageable. In contrast, by using raster, users can<br />

choose to encapsulate them into small blocks as far as they want <strong>for</strong> easy analysis.<br />

For example, all <strong>of</strong> USA can be stored as a grid <strong>of</strong> 500 000 x 300 000 pixels or cells (each cell<br />

represents an area <strong>of</strong> 10 m). In raster <strong>for</strong>mat, these polygons are manageable in 15 000 000 tiles<br />

<strong>of</strong> 100x100 pixels. <strong>The</strong> rest is to intersect vector layers with the raster tiles and apply appropriate<br />

operations to the intersection result.<br />

5.10 Create a Specialised Web or Desktop GIS Application<br />

Complete SQL GIS<br />

With the raster API, <strong>PostGIS</strong> is now a very complete SQL GIS as:<br />

• It provides a single set <strong>of</strong> overlaid functions that work seamlessly on raster and vector files. So<br />

an easy SQL API to manipulate and analyse graphical data.<br />

• All geographic data (vector and raster) is spatially indexed. So there is no need to write complex<br />

C,C++, Python or JAVA code to manipulate complex data.<br />

70

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

Saved successfully!

Ooh no, something went wrong!