This topic describes the operators supported by Raster SQL, including their syntax, parameters, and examples.
Syntax
Raster SQL supports the =, >, <, >=, and <= operators. These operators compare the UUIDs of two raster objects in lexicographical order and are used in operations such as Union and B-tree.
bool Operator <operator>(raster rast1, raster rast2);Return value
Returns true or false based on the result of the UUID comparison.
Only the UUIDs of the two raster objects are compared. The spatial extent, pixel type, or other properties are not compared.
Parameters
Parameter | Description |
rast1 | The first raster object. |
rast2 | The second raster object. |
Examples
Using the filter operators = and <= as examples, other filter operators are used in the same way as = and <=.
Example 1: Compare the UUIDs of raster objects in records that have the same ID.
SELECT a.rast = b.rast FROM tbl_a a, tbl_b b WHERE a.id = b.idIf the condition
a.id=b.idis met, the statement returnstrueif the UUIDs of the corresponding records in the two tables are the same, andfalseotherwise.Example 2: Compare the UUIDs of raster objects that have different IDs.
SELECT a.rast <= b.rast FROM tbl_a a, tbl_b b WHERE a.id = 1 AND b.id = 2;If the condition
a.id = 1 AND b.id = 2is met, the statement returnstrueif the UUID ofa.rastis lexicographically less than or equal to the UUID ofb.rast, andfalseotherwise.