From 4ac4eac462f854ee85eb8f6e43b619fb9ea5750e Mon Sep 17 00:00:00 2001 From: Bborie Park Date: Tue, 22 May 2012 17:06:39 +0000 Subject: [PATCH] Added docs for ST_World2RasterCoord() and ST_Raster2WorldCoord() git-svn-id: http://svn.osgeo.org/postgis/trunk@9796 b70326c6-7e19-0410-871a-916f4a2858ee --- doc/reference_raster.xml | 139 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 139 insertions(+) diff --git a/doc/reference_raster.xml b/doc/reference_raster.xml index cdf287842..5c8eec6f0 100644 --- a/doc/reference_raster.xml +++ b/doc/reference_raster.xml @@ -1825,6 +1825,81 @@ FROM dummy_rast; + + + + ST_Raster2WorldCoord + 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. + + + + + + record ST_Raster2WorldCoord + 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. + + + + + Examples + + +-- non-skewed raster providing column is sufficient +SELECT + rid, + (ST_Raster2WorldCoord(rast,1, 1)).*, + (ST_Raster2WorldCoord(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 + + + +-- for fun lets skew it +SELECT + rid, + (ST_Raster2WorldCoord(rast, 1, 1)).*, + (ST_Raster2WorldCoord(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 + + , + , + , + + + @@ -2291,6 +2366,70 @@ rastwidth + + + + ST_World2RasterCoord + Returns the upper left corner as column and row given geometric X and Y (longitude and latitude) or a point geometry expressed in the spatial reference coordinate system of the raster. + + + + + + integer ST_World2RasterCoord + raster rast + geometry pt + + + + integer ST_World2RasterCoord + raster rast + double precision longitude + double precision latitude + + + + + + Description + + + Returns the upper left corner as column and row given geometric X and Y (longitude and latitude) or a point geometry. + This function works regardless of whether or not the geometric X and Y or point geometry is outside the extent of the raster. + Geometric X and Y must be expressed in the spatial reference coordinate system of the raster. + + + + + Examples + + +SELECT + rid, + (ST_World2RasterCoord(rast,3427927.8,20.5)).*, + (ST_World2RasterCoord(rast,ST_GeomFromText('POINT(3427927.8 20.5)',ST_SRID(rast)))).* +FROM dummy_rast; + + rid | columnx | rowy | columnx | rowy +-----+---------+-----------+---------+----------- + 1 | 1713964 | 7 | 1713964 | 7 + 2 | 2 | 115864471 | 2 | 115864471 + + + + + + See Also + + , + , + , + , + + + + + ST_World2RasterCoordX -- 2.50.1