= '''PostGIS WKT Raster Beta 03 (and up) Working Specifications''' = {{{ #!html
}}} '''Quick Links''' * [wiki:WKTRaster WKT Raster Home Page] * [wiki:WKTRaster/PlanningAndFunding Planning & Funding] * [wiki:WKTRaster/SpecificationWorking01 Working Specifications for Beta 0.1.6] * [wiki:WKTRaster/SpecificationWorking02 Working Specifications for Beta 0.2.4] {{{ #!html
}}} ---- == '''Objective B03a - Being able to set all the properties of a raster.''' == '''ST_SetSRID(raster|geometry, integer)'''[[BR]] '''ST_SetPixelType(raster, band, string)'''[[BR]] '''ST_SetPixelSize(raster)'''[[BR]] '''ST_SetNoDataValue(raster, band, value)'''[[BR]] '''ST_SetGeoReference(raster, string)''' ---- == '''Objective B03b - Being able to reproject a raster.''' == '''ST_Transform(raster|geometry, SRID) -> same type as input''' ---- == '''Objective B03c - Being able to do some base raster operations.''' == '''ST_Area(raster|geometry) -> double'''[[BR]] '''ST_Count(raster, value) -> integer'''[[BR]] '''ST_Resample(raster, pixelsize, method) -> raster''' Recompute a raster in order to change its pixel size and/or the position of its upper left corner. '''ST_SelectByValue(raster|geometry, ‘expression’) -> same type as first argument'''[[BR]] '''ST_Reclass(raster|geometry,string) -> same type as first argument'''[[BR]] '''ST_MapAlgebra(raster|geometry, [raster|geometry,…] ‘mathematical expression’, ‘raster’ |’geometry’) -> raster/geometry''' Variant 1: ST_MapAlgebra(raster|geometry, [raster|geometry,…] ‘mathematical expression’, ‘raster’ |’geometry’, originx, originy, pixelsizex, pixelsizey, rotation ) -> raster/geometry Variant 2: ST_MapAlgebra(raster|geometry, [raster|geometry,…] 'mathematical expression', 'raster' |'geometry', integer) ->raster/geometry Variant 3: ST_MapAlgebra(raster|geometry, [raster|geometry,…] 'mathematical expression', 'raster' |'geometry', raster) ->raster/geometry The first raster passed to ST_MapAlgebra is the 'master' raster, unless either: 1 additional parameter specifies the index (in the parameter list) of the 'master' raster.[[BR]] 1 additional parameter specifies a raster whose origin and cell size should be used to compute the output raster.[[BR]] 4 additional parameters are passed specifying the origin, cell size, and raster rotation. This function implicitly calls ST_Intersects(raster|geometry, [raster|geometry,…]) to detect if the rasters are overlapping before performing any computation. Additionally, the resulting raster will have the same extent as the result of ST_Intersection(raster, integer, geometry). One of the implications of the ST_Intersects inclusion is that: SELECT ST_MapAlgebra(rast1, rast2, mathExpr) FROM mytable WHERE ST_Intersects(rast1, rast2) will be faster than: SELECT ST_MapAlgebra(rast1, rast2, mathExpr) FROM mytable '''Open Question:''' Should ST_MapAlgebra resample rasters internally, or produce a raster that can be processed by ST_Resample? If so, variant 1 and variant 3 can be removed, and all ST_MapAlgebra results can be processed through ST_Resample, like: ST_Resample(ST_MapAlgebra(raster, [raster,…] 'mathematical expression', integer), originx, originy, pixelsizex, pixelsizey)[[BR]] ST_Resample(ST_MapAlgebra(raster, [raster,…] 'mathematical expression', integer), rastergrid) '''ST_Clip(raster|geometry,geometry) -> same type as first argument'''[[BR]] '''ST_Flip(raster|geometry, ’vertical’|’horizontal’) -> same type as first argument''' ---- == '''Objective B03d - Being able to quickly get raster statistics.''' == '''Add cached basic raster statistic to the base raster WKB format. ---- == '''Objective B03e - Being able to refer to band by textual name.''' == '''Add 8 digit string to each band in the base raster WKB format.[[BR]] '''Adjust gdal2wktraster.py to be able to give names to each band when importing.[[BR]] '''Adjust/overlaod every function to be able to refer to raster band by name. ---- == '''PostGIS WKT Raster Beta 0.4''' == ---- == '''Objective B04a - Being able to convert a raster to standards formats.''' == '''ST_AsKML(raster|geometry) -> string'''[[BR]] '''ST_AsSVG(raster|geometry) -> string''' ---- == '''Objective B04b - Being able to control the validity of a raster.''' == '''ST_IsEmpty(raster|geometry) -> boolean'''[[BR]] '''ST_mem_size(raster|geometry) -> integer'''[[BR]] '''ST_isvalid(raster|geometry) -> boolean''' ---- == '''Objective B04c - Being able to use other major topological operators''' == '''ST_Within(raster|geometry A, raster|geometry B)'''[[BR]] '''ST_Contains(raster|geometry A, raster|geometry B)'''[[BR]] '''ST_Overlaps(raster|geometry, raster|geometry)''' ---- == '''PostGIS WKT Raster Beta 0.5''' == ---- == '''Objective B05a - Being able to derive a raster layer from vector layer.''' == '''ST_Interpolate(points, pixelsize, method) -> raster''' ---- == '''Objective B05b - Being able to do on rasters most operations available on geometries''' == '''ST_Centroid(raster|geometry) -> point geometry'''[[BR]] '''ST_PointOnSurface(raster|geometry) -> point geometry'''[[BR]] '''ST_Buffer(raster|geometry, double) -> same type as first arg.'''[[BR]] '''ST_ConvexHull(raster|geometry) -> same type as input'''[[BR]] '''ST_Difference(raster|geometry A, raster|geometry B) -> same type as first argument'''[[BR]] '''ST_SymDifference(raster|geometry,raster|geometry,‘raster’|’geometry’) -> raster/geometry''' ---- == '''PostGIS WKT Raster Beta 0.6''' == ---- == '''Objective B06a - Being able to use all the other topological operators''' == '''ST_Equals(raster|geometry, raster|geometry)'''[[BR]] '''ST_Disjoint(raster|geometry, raster|geometry)'''[[BR]] '''ST_Touches(raster|geometry, raster|geometry)'''[[BR]] '''ST_Crosses(raster|geometry, raster|geometry)'''[[BR]] '''ST_Covers(raster|geometry A, raster|geometry B)'''[[BR]] '''ST_IsCoveredBy(raster|geometry A, raster|geometry B)'''[[BR]] '''ST_Relate(raster|geometry, raster|geometry, intersectionPatternMatrix )''' ---- == '''Objective B07b - Being able to edit a raster''' == '''ST_Value(raster, band, x, y) -> value'''[[BR]] Return value of a single pixel. Pixel location is specified by 1-based index of Nth band of raster and X,Y coordinates.[[BR]] The X coordinate is expected to be in range of [1, ST_Width(raster)] and Y coordinate in range of [1, ST_Height(raster))]. Return value is of type of 64-bit float-point number.[[BR]] '''TODO''': mloskot: Should we return NUMERIC instead of FLOAT8? '''ST_SetValue(raster, band, x, y, value)'''[[BR]] '''ST_Affine(raster|geometry,…) -> same type as input'''[[BR]] '''ST_Translate(raster|geometry,…) -> same type as input'''[[BR]] '''ST_Scale(raster|geometry,…) -> same type as input'''[[BR]] '''ST_TransScale(raster|geometry,…) -> same type as input'''[[BR]] '''ST_RotateZ,Y,Z(raster|geometry, float8) -> same type as input''' '''Other functions''' '''ST_AsBinary(raster, compression)'''[[BR]] '''ST_RasterFromWKB(raster, [])'''[[BR]] '''ST_RasterFromText(string, [])'''[[BR]] '''ST_AsText(raster)''' ----