[postgis-devel] [PostGIS] #903: [raster] ST_Reclass
PostGIS
trac at osgeo.org
Thu Apr 7 21:37:32 PDT 2011
#903: [raster] ST_Reclass
----------------------------+-----------------------------------------------
Reporter: dustymugs | Owner: dustymugs
Type: task | Status: new
Priority: medium | Milestone: PostGIS Raster Future
Component: postgis raster | Version: trunk
Keywords: |
----------------------------+-----------------------------------------------
Comment(by dustymugs):
I have two questions/concerns about the current concept.
1. ST_Reclass() with a variable number of function parameters would be
ideal. But I don't believe pl/plgsql is able to do that. It does support
variadic arguments but nothing like C's argc and argv (as far as I can
tell). Variadic argument was added to PostgreSQL in 8.4 so I also wonder
what is the minimum version that PostGIS supports. If the minimum in 8.2
or 8.3, variadic functions may not be an option.
Maybe we should consider two separate approaches, one less efficient and
one more so that may not be quite as friendly...
ST_Reclass(rast raster, nband int, reclassexpr text, pixeltype text)
This would be fine if you're only going to reclassify one band but is
absolutely inefficient for multiple bands...
{{{
ST_Reclass(rast, 1, SOME_EXPRESSION, '8BUI')
}}}
and
{{{
ST_Reclass(
ST_Reclass(
ST_Reclass(
ST_Band(rast, ARRAY[1,1,1])
, 1, SOME_EXPRESSION, '8BUI'
)
, 2, SOME_EXPRESSION, '8BUI'
)
, 3, SOME_EXPRESSION, '8BUI'
)
}}}
The second example is absolutely inefficient. So, a more efficient method
could be
ST_Reclass(rast, reclassexpr_set text[])
where reclassexpr_set is a two dimension array like
ARRAY[
[nband int, reclassexpr text, pixeltype text],
[nband int, reclassexpr text, pixeltype text],
...
[nband int, reclassexpr text, pixeltype text],
]
2. I have a question about the range in the reclassexpr.
If we look at the following, I wonder what the min(covmin, 0)-0 and
0-max(covmax, 0) really means?
min(covmin, 0)-0:0,0-max(covmax, 0):0-255
Does it mean...
min(covmin, 0) <= x < 0 and 0 <= x < max(covmax, 0)
or
min(covmin, 0) <= x <= 0 and 0 <= x <= max(covmax, 0)
or
min(covmin, 0) < x <= 0 and 0 < x <= max(covmax, 0)
something else?
So what happens when x is at the limit of the range?
Thoughts?
--
Ticket URL: <http://trac.osgeo.org/postgis/ticket/903#comment:2>
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