Raster SQL supports five comparison operators for raster objects: =, >, <, >=, and <=. These operators compare the UUIDs of two raster objects in lexicographic order and are used in Union and B-tree operations.
Operator summary
| Operator | Returns true when |
|---|---|
= | The UUID of rast1 equals the UUID of rast2 |
> | The UUID of rast1 is lexicographically greater than the UUID of rast2 |
< | The UUID of rast1 is lexicographically less than the UUID of rast2 |
>= | The UUID of rast1 is lexicographically greater than or equal to the UUID of rast2 |
<= | The UUID of rast1 is lexicographically less than or equal to the UUID of rast2 |
These operators compare only the UUIDs of raster objects. Spatial extent, pixel type, and other properties are not compared.
Syntax
bool Operator <operator>(raster rast1, raster rast2);Return value: true or false based on the UUID comparison result.
Parameters
| Parameter | Description |
|---|---|
rast1 | The first raster object. |
rast2 | The second raster object. |
Examples
The following examples use = and <=. All other operators follow the same pattern.
Example 1: Compare raster objects with the same record ID
SELECT a.rast = b.rast
FROM tbl_a a, tbl_b b
WHERE a.id = b.id;Returns true if the UUIDs of the matching records are identical, false otherwise.
Example 2: Compare raster objects with different record IDs
SELECT a.rast <= b.rast
FROM tbl_a a, tbl_b b
WHERE a.id = 1 AND b.id = 2;Returns true if the UUID of a.rast is lexicographically less than or equal to the UUID of b.rast, false otherwise.