Version 19 (modified by pracine, 10 years ago) (diff)


PostGIS WKT Raster Beta 0.2.4 Working Specifications

Objective B02x - Being able to intersect vector and raster to produce raster.

ST_Intersects(raster, raster)
ST_AsRaster(geometry, pixelsize) -> raster
ST_Intersection(geometry, val, raster, band) -> raster

The first series of variant return a raster having the same extent as the provided raster.

Variant 1: ST_Intersection(geometry, val, raster, band) -> raster

Variant 2: ST_Intersection(raster, band, geometry, val) -> raster

Variant 3: ST_Intersection(geometry, val, raster) -> raster

Variant 4: ST_Intersection(raster, geometry, val) -> raster

The second series of variant return a raster having the minimal extent.

Variant 5: ST_Intersection(geometry, val, raster, band, 'TRIM') -> raster

Variant 6: ST_Intersection(raster, band, geometry, val, 'TRIM') -> raster

Variant 7: ST_Intersection(geometry, val, raster, 'TRIM') -> raster

Variant 8: ST_Intersection(raster, geometry, val, 'TRIM') -> raster

Return a two bands raster the first band containing only the pixels from the provided raster intersecting with the geometry and the second band containing the same area filled with the provided value. Non intersecting pixels are filled with nodata values. Variant 1 return a raster having the same extent as the provided raster. Variant 3, 4, 7 and 8 defaults the band number to 1. Variant 5 to 8 "trim" or "crop" the raster to the withvalue extent (removing extra nodata value pixels surrounding the extent of the resulting withvalue extent).

Open question

PR: Shoud we return one raster per raster/geometry couple or split the raster into as many small rasters as there are areas sharing a same value? The second behavior seems more coherent with the present behavior of ST_Intersection(raster, geometry) -> geometry even if this would produce tons of small two bands rasters.

Implementation details

Rasterize the geometry as a new raster (ST_AsRaster(geometry, pixeltype, val, nodataval, raster)) and then copy only pixels for which both raster bands have a value. Should be implemented as a wrapper around ST_MapAlgebra after rasterizing the geometry to a raster having the same alignment as the raster.

Objective B02x - Being able to use "group by" to accumulate tiles to form a new raster.

ST_Union(raster|geometry, raster|geometry, ‘raster’|’geometry’) -> raster/geometry
ST_Accum(raster set|geometry set, ‘raster’|’geometry’) -> raster/geometry

Objective B02x - Being able to set and get the skew of a raster in terms of rotation.

ST_SetRotation(raster, angle)

Set the rotation of the raster. This method actually derive values for pixelsizex, pixelsizey, skewx and skewy based on the provided rotation angle.

Open Question:

PR: The angle should be provided in radian or in degree?

ST_Rotation(raster) -> float64

Return the georeference's rotation angle in (degree or radiant?) derived from the pixel size and the skew.

PR: I think getting the rotation get no sence since the result of pixelsizes and skew is not necessarily a rotation. It make sence to set it though.

Attachments (2)

Download all attachments as: .zip