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
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
SELECt rid, ST_UpperLeftX(rast)<br />
FROM dummy_rast;<br />
--Set the upper left corner coordinates <strong>of</strong> the raster whose rid number is 1<br />
--from the table dummy_rast:<br />
SELECT ST_SetUpperLeft(rast,-71.01,42.37)<br />
FROM dummy_rast WHERE rid = 1;<br />
• SRID and number <strong>of</strong> bands<br />
–Get SRID <strong>of</strong> the raster whose rid is 1:<br />
SELECT ST_SRID(rast) As srid<br />
FROM dummy_rast WHERE rid=1;<br />
–Set SRID <strong>of</strong> the raster whose rid is 1:<br />
SELECT ST_SETSRID(rast) As newRast<br />
FROM dummy_rast WHERE rid=1;<br />
–Get number <strong>of</strong> bands <strong>of</strong> the raster whose rid is 1:<br />
SELECT rid, ST_NumBands(rast)<br />
FROM dummy_rast Where rid = 1;<br />
• Get and set band properties –Pixel type and nodata value Get pixel type <strong>of</strong> band number 1 <strong>of</strong><br />
the raster whose rid is 1:<br />
SELECT ST_BandPixelType(rast,1)<br />
FROM dummy_rast<br />
WHERE rid = 1;<br />
Get no data value <strong>of</strong> band number 2 <strong>of</strong> the raster whose rid is 1:<br />
SELECT ST_BandNoDataValue(rast,2)<br />
FROM dummy_rast<br />
WHERE rid = 1;<br />
Set no data value <strong>of</strong> band number 2 <strong>of</strong> the raster, whose rid is 1, to 254:<br />
UPDATE dummy_rast<br />
SET rast = ST_SetBandNoDataValue(rast,2, 254)<br />
WHERE rid = 1;<br />
• Reproject rasters This operation will reproject the geographic locations <strong>of</strong> rasters into any appropriate<br />
coordinate system <strong>for</strong> execution <strong>of</strong> some spatial operations. <strong>The</strong> reprojection is executed<br />
using ST\_Trans<strong>for</strong>m(raster, srid, algorithm). This function uses specified resampling<br />
algorithm such as NearestNeighbor, Bilinear, Cubic, CubicSpline or Lanczos. Default is NearestNeighbor.<br />
<strong>The</strong> following query trans<strong>for</strong>ms all rasters <strong>of</strong> the dummy_rast table into WGS 84<br />
(having the SRID number 4326) using Bilinear algorithm:<br />
SELECT ST_Trans<strong>for</strong>m(rast,4326,’Bilinear’)<br />
FROM dummy_rast ;<br />
• Resample a raste Resample a raster with new dimensions, an arbitrary grid corner and a set <strong>of</strong><br />
raster georeferencing attributes. This operation is per<strong>for</strong>med using ST_Resample(raster, width,<br />
height, algorithm). New pixel values are computed using the NearestNeighbor, Bilinear, Cubic,<br />
CubicSpline or Lanczos resampling algorithm. Default is NearestNeighbor.<br />
63