In order to use these functions, you need PostGIS 1.4 above installed in your database as well as wktraster compiled and the rtpostgis.sql loaded in your database.
This will change later once the two projects are fully integrated.</para>
<para>For more information about WKT Raster, please refer to <ulink url="http://trac.osgeo.org/postgis/wiki/WKTRaster">PostGIS WKT Raster Home Page</ulink>.</para>
- <sect1 id="Raster_Outputs">
- <title>Raster Outputs</title>
- <refentry id="RT_ST_AsBinary">
- <refnamediv>
- <refname>ST_AsBinary</refname>
- <refpurpose>Return the Well-Known Binary (WKB) representation of the raster without SRID meta data.</refpurpose>
- </refnamediv>
-
- <refsynopsisdiv>
- <funcsynopsis>
- <funcprototype>
- <funcdef>bytea <function>ST_AsBinary</function></funcdef>
- <paramdef><type>raster </type> <parameter>rast</parameter></paramdef>
- </funcprototype>
- </funcsynopsis>
- </refsynopsisdiv>
-
- <refsection>
- <title>Description</title>
-
- <para>Returns the Binary representation of the raster. There are 2 variants of the function. The first
- variant takes no endian encoding paramater and defaults to little endian. The second variant takes a second argument
- denoting the encoding - using little-endian ('NDR') or big-endian ('XDR') encoding.</para>
- <para>This is useful in binary cursors to pull data out of the
- database without converting it to a string representation.</para>
- </refsection>
+ <para>For the examples in this reference we will be using a raster table of dummy rasters - Formed with the following code </para>
+ <programlisting>
+CREATE TABLE dummy_rast(rast raster);
+INSERT INTO dummy_rast(rast)
+VALUES(
+('01' -- little endian (uint8 ndr)
+||
+'0000' -- version (uint16 0)
+||
+'0000' -- nBands (uint16 0)
+||
+'0000000000000040' -- scaleX (float64 2)
+||
+'0000000000000840' -- scaleY (float64 3)
+||
+'000000000000E03F' -- ipX (float64 0.5)
+||
+'000000000000E03F' -- ipY (float64 0.5)
+||
+'0000000000000000' -- skewX (float64 0)
+||
+'0000000000000000' -- skewY (float64 0)
+||
+'0A000000' -- SRID (int32 10)
+||
+'0A00' -- width (uint16 10)
+||
+'1400' -- height (uint16 20)
+)::raster
+);
+ </programlisting>
+
+ <sect1 id="Raster_Accessors">
+ <title>Raster Accessorts</title>
+ <refentry id="RT_ST_Height">
+ <refnamediv>
+ <refname>ST_Height</refname>
+ <refpurpose>Returns the height of the raster in pixels?</refpurpose>
+ </refnamediv>
+
+ <refsynopsisdiv>
+ <funcsynopsis>
+ <funcprototype>
+ <funcdef>integer <function>ST_Height</function></funcdef>
+ <paramdef><type>raster </type> <parameter>rast</parameter></paramdef>
+ </funcprototype>
+ </funcsynopsis>
+ </refsynopsisdiv>
+
+ <refsection>
+ <title>Description</title>
+
+ <para>Returns the height of the raster.</para>
+ </refsection>
+
+ <refsection>
+ <title>Examples</title>
+
+ <programlisting>SELECT ST_Height(rast) As rastheight
+FROM dummy_rast LIMIT 1;
- <refsection>
- <title>Examples</title>
+rastheight
+----------------
+20
+ </programlisting>
+
+ </refsection>
+
+ <!-- Optionally add a "See Also" section -->
+ <refsection>
+ <title>See Also</title>
+ <para><xref linkend="RT_ST_Width" /></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 LIMIT 1;
- <programlisting>CREATE TABLE dummy_rast(rast raster);
+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">
+ <title>Raster Outputs</title>
+ <refentry id="RT_ST_AsBinary">
+ <refnamediv>
+ <refname>ST_AsBinary</refname>
+ <refpurpose>Return the Well-Known Binary (WKB) representation of the raster without SRID meta data.</refpurpose>
+ </refnamediv>
+
+ <refsynopsisdiv>
+ <funcsynopsis>
+ <funcprototype>
+ <funcdef>bytea <function>ST_AsBinary</function></funcdef>
+ <paramdef><type>raster </type> <parameter>rast</parameter></paramdef>
+ </funcprototype>
+ </funcsynopsis>
+ </refsynopsisdiv>
+
+ <refsection>
+ <title>Description</title>
+
+ <para>Returns the Binary representation of the raster. There are 2 variants of the function. The first
+ variant takes no endian encoding paramater and defaults to little endian. The second variant takes a second argument
+ denoting the encoding - using little-endian ('NDR') or big-endian ('XDR') encoding.</para>
+ <para>This is useful in binary cursors to pull data out of the
+ database without converting it to a string representation.</para>
+ </refsection>
+
+ <refsection>
+ <title>Examples</title>
+
+ <programlisting>CREATE TABLE dummy_rast(rast raster);
INSERT INTO dummy_rast(rast)
VALUES(
('01' -- little endian (uint8 ndr)
)::raster
);
SELECT ST_AsBinary(rast) As rastbin
- FROM dummy_rast LIMIT 1;
-
- rastbin
+FROM dummy_rast LIMIT 1;
+
+ rastbin
---------------------------------------------------------------------------------
- \001\000\000\000\000\000\000\000\000\000\000\000@\000\000\000\000\000\000\010@\
+\001\000\000\000\000\000\000\000\000\000\000\000@\000\000\000\000\000\000\010@\
000\000\000\000\000\000\340?\000\000\000\000\000\000\340?\000\000\000\000\000\00
0\000\000\000\000\000\000\000\000\000\000\012\000\000\000\012\000\024\000
-</programlisting>
+ </programlisting>
- </refsection>
-
- <!-- Optionally add a "See Also" section -->
- <refsection>
- <title>See Also</title>
- <para></para>
- </refsection>
- </refentry>
- </sect1>
+ </refsection>
+
+ <!-- Optionally add a "See Also" section -->
+ <refsection>
+ <title>See Also</title>
+ <para></para>
+ </refsection>
+ </refentry>
+ </sect1>
</chapter>