<programlisting>
CREATE TABLE dummy_rast(rid integer, rast raster);
INSERT INTO dummy_rast(rid, rast)
-VALUES(1,
+VALUES (1,
('01' -- little endian (uint8 ndr)
||
'0000' -- version (uint16 0)
||
'1400' -- height (uint16 20)
)::raster
-);
+),
+-- Raster: 5 x 5 pixels, 3 bands, PT_8BUI pixel type, NODATA = 0
+(2, ('01000003009A9999999999A93F9A9999999999A9BF000000E02B274A' ||
+'41000000007719564100000000000000000000000000000000FFFFFFFF050005000400FDFEFDFEFEFDFEFEFDF9FAFEF' ||
+'EFCF9FBFDFEFEFDFCFAFEFEFE04004E627AADD16076B4F9FE6370A9F5FE59637AB0E54F58617087040046566487A1506CA2E3FA5A6CAFFBFE4D566DA4CB3E454C5665')::raster);
</programlisting>
<sect1 id="Raster_Accessors">
<title>Raster Accessors</title>
- <refentry id="RT_ST_Height">
+ <refentry id="RT_ST_BandNoDataValue">
<refnamediv>
- <refname>ST_Height</refname>
- <refpurpose>Returns the height of the raster in pixels?</refpurpose>
+ <refname>ST_BandNoDataValue</refname>
+ <refpurpose>Returns the value in a given band that represents no data.</refpurpose>
</refnamediv>
<refsynopsisdiv>
<funcsynopsis>
<funcprototype>
- <funcdef>integer <function>ST_Height</function></funcdef>
+ <funcdef>integer <function>ST_BandNoDataValue</function></funcdef>
<paramdef><type>raster </type> <parameter>rast</parameter></paramdef>
+ <paramdef><type>integer </type> <parameter>bandnum</parameter></paramdef>
</funcprototype>
</funcsynopsis>
</refsynopsisdiv>
<refsection>
<title>Description</title>
- <para>Returns the height of the raster.</para>
+ <para>Returns the value that represents no data for the band</para>
</refsection>
<refsection>
<title>Examples</title>
- <programlisting>SELECT ST_Height(rast) As rastheight
-FROM dummy_rast WHERE rid=1;
-
-rastheight
-----------------
-20
+ <programlisting><!-- TODO: Need example -->
</programlisting>
</refsection>
+
+ <refsection>
+ <title>See Also</title>
+ <para><xref linkend="RT_ST_NumBands" /></para>
+ </refsection>
+ </refentry>
- <!-- Optionally add a "See Also" section -->
+ <refentry id="RT_ST_BandPixelType">
+ <refnamediv>
+ <refname>ST_BandPixelType</refname>
+ <refpurpose>Returns the type of pixel for given band.</refpurpose>
+ </refnamediv>
+
+ <refsynopsisdiv>
+ <funcsynopsis>
+ <funcprototype>
+ <funcdef>integer <function>ST_BandNoDataValue</function></funcdef>
+ <paramdef><type>raster </type> <parameter>rast</parameter></paramdef>
+ <paramdef><type>integer </type> <parameter>bandnum</parameter></paramdef>
+ </funcprototype>
+ </funcsynopsis>
+ </refsynopsisdiv>
+
+ <refsection>
+ <title>Description</title>
+
+ <para>Returns the value that represents no data for the band</para>
+ </refsection>
+
+ <refsection>
+ <title>Examples</title>
+
+ <programlisting>SELECT ST_BandPixelType(rast,1) As btype1,
+ ST_BandPixelType(rast,2) As btype2, ST_BandPixelType(rast,3) As btype3
+FROM dummy_rast
+WHERE rid = 2;
+
+ btype1 | btype2 | btype3
+--------+--------+--------
+ 8BUI | 8BUI | 8BUI
+ </programlisting>
+
+ </refsection>
+
<refsection>
<title>See Also</title>
- <para><xref linkend="RT_ST_Width" /></para>
+ <para><xref linkend="RT_ST_NumBands" /></para>
</refsection>
</refentry>
- <refentry id="RT_ST_NumBands">
+ <refentry id="RT_ST_GeoReference">
<refnamediv>
- <refname>ST_NumBands</refname>
- <refpurpose>Returns the number of bands in the raster object.</refpurpose>
+ <refname>ST_GeoReference</refname>
+ <refpurpose>Returns the georeference meta data in GDAL or ESRI format. Default is GDAL.</refpurpose>
</refnamediv>
<refsynopsisdiv>
<funcsynopsis>
<funcprototype>
- <funcdef>integer <function>ST_NumBands</function></funcdef>
+ <funcdef>text <function>ST_GeoReference</function></funcdef>
+ <paramdef><type>raster </type> <parameter>rast</parameter></paramdef>
+ </funcprototype>
+ <funcprototype>
+ <funcdef>text <function>ST_GeoReference</function></funcdef>
<paramdef><type>raster </type> <parameter>rast</parameter></paramdef>
+ <paramdef><type>text </type> <parameter>format</parameter></paramdef>
</funcprototype>
</funcsynopsis>
</refsynopsisdiv>
<refsection>
<title>Description</title>
- <para>Returns the number of bands in the raster object.</para>
+ <para>Returns the georeference meta data in GDAL or ESRI format. Default is GDAL if no type specified. type is string 'GDAL' or 'ESRI'.</para>
+ <para>Difference between format representations is as follows:</para>
+ <para><varname>GDAL</varname>:
+<progromlisting>pixelsizex
+skewy
+skewx
+pixelsizey
+upperleftx
+upperlefty</progromlisting></para>
+ <para><varname>ESRI</varname>:
+<progromlisting>pixelsizex
+skewy
+skewx
+pixelsizey
+upperleftx + pixelsizex*0.5
+upperleftx + pixelsizey*0.5</progromlisting></para>
</refsection>
<refsection>
<title>Examples</title>
- <programlisting>SELECT ST_NumBands(rast) As numbands
-FROM dummy_rast WHERE rid=1;
+ <programlisting>SELECT ST_GeoReference(rast, 'ESRI') As esri_ref, ST_GeoReference(rast, 'GDAL') As gdal_ref
+ FROM dummy_rast WHERE rid=1;
-numbands
-----------------
-0
+ esri_ref | gdal_ref
+--------------+--------------
+ 2.0000000000 | 2.0000000000
+ 0.0000000000 : 0.0000000000
+ 0.0000000000 : 0.0000000000
+ 3.0000000000 : 3.0000000000
+ 1.5000000000 : 0.5000000000
+ 2.0000000000 : 0.5000000000
</programlisting>
</refsection>
-
- <!-- Optionally add a "See Also" section -->
+
<refsection>
<title>See Also</title>
- <para><xref linkend="RT_ST_Value" /></para>
+ <para><xref linkend="RT_ST_PixelSizeX" />, <xref linkend="RT_ST_PixelSizeY" /></para>
</refsection>
</refentry>
- <refentry id="RT_ST_PixelSizeX">
+ <refentry id="RT_ST_Height">
<refnamediv>
- <refname>ST_PixelSizeX</refname>
- <refpurpose>Returns the x size of pixels in units of coordinate reference system?</refpurpose>
+ <refname>ST_Height</refname>
+ <refpurpose>Returns the height of the raster in pixels?</refpurpose>
</refnamediv>
<refsynopsisdiv>
<funcsynopsis>
<funcprototype>
- <funcdef>float8 <function>ST_PixelSizeX</function></funcdef>
+ <funcdef>integer <function>ST_Height</function></funcdef>
<paramdef><type>raster </type> <parameter>rast</parameter></paramdef>
</funcprototype>
</funcsynopsis>
<refsection>
<title>Description</title>
- <para>Returns the x size of pixels in units of coordinate reference system?</para>
+ <para>Returns the height of the raster.</para>
</refsection>
<refsection>
<title>Examples</title>
- <programlisting>SELECT ST_PixelSizeX(rast) As rastpixwidth
-FROM dummy_rast WHERE rid=1;
+ <programlisting>SELECT rid, ST_Height(rast) As rastheight
+FROM dummy_rast;
-rastpixwidth
-----------------
-2
+ rid | rastheight
+-----+------------
+ 1 | 20
+ 2 | 5
</programlisting>
</refsection>
+
+ <refsection>
+ <title>See Also</title>
+ <para><xref linkend="RT_ST_Width" /></para>
+ </refsection>
+ </refentry>
+
+ <refentry id="RT_ST_NumBands">
+ <refnamediv>
+ <refname>ST_NumBands</refname>
+ <refpurpose>Returns the number of bands in the raster object.</refpurpose>
+ </refnamediv>
+
+ <refsynopsisdiv>
+ <funcsynopsis>
+ <funcprototype>
+ <funcdef>integer <function>ST_NumBands</function></funcdef>
+ <paramdef><type>raster </type> <parameter>rast</parameter></paramdef>
+ </funcprototype>
+ </funcsynopsis>
+ </refsynopsisdiv>
+
+ <refsection>
+ <title>Description</title>
+
+ <para>Returns the number of bands in the raster object.</para>
+ </refsection>
+
+ <refsection>
+ <title>Examples</title>
+
+ <programlisting>SELECT rid, ST_NumBands(rast) As numbands
+FROM dummy_rast;
+
+rid | numbands
+----+----------
+ 1 | 0
+ 2 | 3
+ </programlisting>
+ </refsection>
<!-- Optionally add a "See Also" section -->
<refsection>
<title>See Also</title>
- <para><xref linkend="RT_ST_Width" /></para>
+ <para><xref linkend="RT_ST_Value" /></para>
</refsection>
</refentry>
- <refentry id="RT_ST_PixelSizeY">
+ <refentry id="RT_ST_PixelSizeX">
<refnamediv>
- <refname>ST_PixelSizeY</refname>
- <refpurpose>Returns the y size of pixels in units of coordinate reference system?</refpurpose>
+ <refname>ST_PixelSizeX</refname>
+ <refpurpose>Returns the x size of pixels in units of coordinate reference system?</refpurpose>
</refnamediv>
<refsynopsisdiv>
<funcsynopsis>
<funcprototype>
- <funcdef>float8 <function>ST_PixelSizeY</function></funcdef>
+ <funcdef>float8 <function>ST_PixelSizeX</function></funcdef>
<paramdef><type>raster </type> <parameter>rast</parameter></paramdef>
</funcprototype>
</funcsynopsis>
<refsection>
<title>Description</title>
- <para>Returns the y size of pixels in units of coordinate reference system?</para>
+ <para>Returns the x size of pixels in units of coordinate reference system?</para>
</refsection>
<refsection>
<title>Examples</title>
- <programlisting>SELECT ST_PixelSizeY(rast) As rastpixheight
-FROM dummy_rast WHERE rid=1;
+ <programlisting>SELECT rid, ST_PixelSizeX(rast) As rastpixwidth
+FROM dummy_rast;
-rastpixheight
-----------------
-3
+ rid | rastpixwidth
+-----+--------------
+ 1 | 2
+ 2 | 0.05
</programlisting>
</refsection>
<!-- Optionally add a "See Also" section -->
<refsection>
<title>See Also</title>
- <para><xref linkend="RT_ST_Height" /></para>
+ <para><xref linkend="RT_ST_Width" /></para>
</refsection>
</refentry>
- <refentry id="RT_ST_Width">
+ <refentry id="RT_ST_PixelSizeY">
<refnamediv>
- <refname>ST_Width</refname>
- <refpurpose>Returns the width of the raster in pixels?</refpurpose>
+ <refname>ST_PixelSizeY</refname>
+ <refpurpose>Returns the y size of pixels in units of coordinate reference system?</refpurpose>
</refnamediv>
<refsynopsisdiv>
<funcsynopsis>
<funcprototype>
- <funcdef>integer <function>ST_Width</function></funcdef>
+ <funcdef>float8 <function>ST_PixelSizeY</function></funcdef>
<paramdef><type>raster </type> <parameter>rast</parameter></paramdef>
</funcprototype>
</funcsynopsis>
<refsection>
<title>Description</title>
- <para>Returns the width of the raster.</para>
+ <para>Returns the y size of pixels in units of coordinate reference system?</para>
</refsection>
<refsection>
<title>Examples</title>
- <programlisting>SELECT ST_Width(rast) As rastwidth
-FROM dummy_rast WHERE rid=1;
+ <programlisting>SELECT rid, ST_PixelSizeY(rast) As rastpixheight
+FROM dummy_rast;
-rastwidth
-----------------
-10
+ rid | rastpixheight
+-----+---------------
+ 1 | 3
+ 2 | -0.05 --this might be a bug
</programlisting>
</refsection>
<para><xref linkend="RT_ST_NumBands" /></para>
</refsection>
</refentry>
+
+ <refentry id="RT_ST_Width">
+ <refnamediv>
+ <refname>ST_Width</refname>
+ <refpurpose>Returns the width of the raster in pixels?</refpurpose>
+ </refnamediv>
+
+ <refsynopsisdiv>
+ <funcsynopsis>
+ <funcprototype>
+ <funcdef>integer <function>ST_Width</function></funcdef>
+ <paramdef><type>raster </type> <parameter>rast</parameter></paramdef>
+ </funcprototype>
+ </funcsynopsis>
+ </refsynopsisdiv>
+
+ <refsection>
+ <title>Description</title>
+
+ <para>Returns the width of the raster.</para>
+ </refsection>
+
+ <refsection>
+ <title>Examples</title>
+
+ <programlisting>SELECT ST_Width(rast) As rastwidth
+FROM dummy_rast WHERE rid=1;
+
+rastwidth
+----------------
+10
+ </programlisting>
+
+ </refsection>
+
+ <!-- Optionally add a "See Also" section -->
+ <refsection>
+ <title>See Also</title>
+ <para><xref linkend="RT_ST_Height" /></para>
+ </refsection>
+ </refentry>
</sect1>
<sect1 id="Raster_Outputs">