[postgis-devel] [PostGIS] #1058: [raster] Two-raster spatial operations framework proposal
PostGIS
trac at osgeo.org
Thu Jun 23 10:42:24 PDT 2011
#1058: [raster] Two-raster spatial operations framework proposal
----------------------------+-----------------------------------------------
Reporter: bnordgren | Owner: pracine
Type: enhancement | Status: new
Priority: medium | Milestone: PostGIS 2.0.0
Component: postgis raster | Version: 1.5.X
Keywords: |
----------------------------+-----------------------------------------------
Note: this patch requires #1050 and #1053, and introduces a dependency
from rt_pg to postgis-2.0.so. The patch applies against #7453.
I doubt this is usable yet, but there's enough here to start people
talking (e.g., draw fire). This is a C based framework for two-raster
operations returning a raster result. The two "major phases" of such a
task are: precalculate the expected extent of the result; and iterate over
the result raster to produce one value per cell. Both major phases have
been encapsulated in their own function, and both use ''function
callbacks'' as a mechanism to implement extension points. The framework
takes differing alignments, cell sizes, and projections into account, such
that the callbacks need only to worry about their fundamental task.
----
The grid extent function has one extension point defined: calculate extent
of result. The remainder of the function retrieves the extents of the two
input rasters and projects them into the result srid, creates a raster of
the appropriate size, and sets various metadata fields. The four current
implementations of this extension point calculate extents for
"intersection", "difference", "union" and "symdifference".
----
The result-raster-iteration function has two extension points defined:
determine whether a cell is included in the result; and provide a value
for the cell.
There are four implementations of "determine whether a cell is included in
the result", corresponding to the four extent calculations:
"intersection", "difference", "union" and "symdifference".
There are two implementations of "provide a value for the cell": one
generates a mask; the other copies image data from one of the input
rasters (r1 if possible, r2 if not). The implementation which copies image
data sets "not present" cells to nodata.
----
Provided one can access Postgresql's expression parser from C, it should
be possible to implement a 2 raster !MapAlgebra by implementing a "provide
a value for the cell" extension. The interface may have to be augmented
slightly to allow "user" parameters to be passed (such as the expression
itself, as well as the bindings from symbol to band)
--
Ticket URL: <http://trac.osgeo.org/postgis/ticket/1058>
PostGIS <http://trac.osgeo.org/postgis/>
The PostGIS Trac is used for bug, enhancement & task tracking, a user and developer wiki, and a view into the subversion code repository of PostGIS project.
More information about the postgis-devel
mailing list