ST_RasterToWorldCoord
Prev | 12.4. Raster Accessors | Next

## Name

ST_RasterToWorldCoord — Returns the raster's upper left corner as geometric X and Y (longitude and latitude) given a column and row. Column and row starts at 1.

## Synopsis

`record ST_RasterToWorldCoord(`raster rast, integer xcolumn, integer yrow`)`;

## Description

Returns the upper left corner as geometric X and Y (longitude and latitude) given a column and row. Returned X and Y are in geometric units of the georeferenced raster. Numbering of column and row starts at 1 but if either parameter is passed a zero, a negative number or a number greater than the respective dimension of the raster, it will return coordinates outside of the raster assuming the raster's grid is applicable outside the raster's bounds.

Availability: 2.1.0

## Examples

    -- non-skewed raster
    SELECT
        rid,
        (ST_RasterToWorldCoord(rast,1, 1)).*,
        (ST_RasterToWorldCoord(rast,2, 2)).*
    FROM dummy_rast

     rid | longitude  | latitude | longitude |  latitude
    -----+------------+----------+-----------+------------
       1 |        0.5 |      0.5 |       2.5 |        3.5
       2 | 3427927.75 |  5793244 | 3427927.8 | 5793243.95

    -- skewed raster
    SELECT
        rid,
        (ST_RasterToWorldCoord(rast, 1, 1)).*,
        (ST_RasterToWorldCoord(rast, 2, 3)).*
    FROM (
        SELECT
            rid,
            ST_SetSkew(rast, 100.5, 0) As rast
        FROM dummy_rast
    ) As foo

     rid | longitude  | latitude | longitude | latitude
    -----+------------+----------+-----------+-----------
       1 |        0.5 |      0.5 |     203.5 |       6.5
       2 | 3427927.75 |  5793244 | 3428128.8 | 5793243.9

## See Also

ST_RasterToWorldCoordX, ST_RasterToWorldCoordY, ST_SetSkew

Prev | Up | Next
ST_ScaleY | Home | ST_RasterToWorldCoordX