[postgis-tickets] [PostGIS] #2247: [raster] Create ST_CreateOverviews()
PostGIS
trac at osgeo.org
Fri Aug 29 06:17:13 PDT 2014
#2247: [raster] Create ST_CreateOverviews()
-------------------------------+--------------------------------------------
Reporter: dzwarg | Owner: dzwarg
Type: enhancement | Status: new
Priority: medium | Milestone: PostGIS 2.2.0
Component: raster | Version: trunk
Keywords: raster, overviews |
-------------------------------+--------------------------------------------
Comment(by pracine):
Replying to [comment:8 strk]:
> @dzwarg, given your pseudo-code for ST_CreateOverviews in the wiki, the
function seems to be not dependent on ST_MakeEmptyCoverage, nor on
ST_SetValues. Am I missing anything ?
ST_MakeEmptyCoverage() is useful in the irregular case (the last ELSE
specifying Resample(all the tiles) in the pseudo code). The only way to
create overview from a messy coverage (with irregular and/or overlapping
tiles) would be to regenerate each tiles at a lower resolution. However a
good overview has to merge neighbouring tiles in order to be able to lower
their resolution deeper and deeper (got the point?).
So before resampling, if the base coverage is messy, we first need to
resample it to a clean regular coverage. Thus the need for the
ST_MakeEmptyCoverage() function. Then you can resample the messy coverage
using tiles from the newly empty coverage as reference raster tiles.
It is not an easy job to go from a messy coverage to a clean one and it is
a very desirable feature. Then the question is "How to resample to the
regular tiles?" You can use ST_Resample() and union tile's fragments to
complete tiles but this does not answer the problem of overlapping tiles
(you might want the mean of two overlapping pixel value as the new value).
A better (but slow) resampler is to use ST_MapAlgebra the same way I use
it to rasterize a vector coverage in ST_ExtractToRaster (see Method 2 in
http://geospatialelucubrations.blogspot.ca/2014/05/a-guide-to-
rasterization-of-vector.html) but using the already implemented pixel
extraction methods from the ST_ExtractPixelCentroidValue4ma call back:
FIRST_RASTER_VALUE_AT_PIXEL_CENTROID,
MIN_OF_RASTER_VALUES_AT_PIXEL_CENTROID,
MAX_OF_RASTER_VALUES_AT_PIXEL_CENTROID,
MEAN_OF_RASTER_VALUES_AT_PIXEL_CENTROID. There is also
COUNT_OF_RASTER_VALUES_AT_PIXEL_CENTROID,
SUM_OF_RASTER_VALUES_AT_PIXEL_CENTROID,
STDDEVP_OF_RASTER_VALUES_AT_PIXEL_CENTROID,
RANGE_OF_RASTER_VALUES_AT_PIXEL_CENTROID but they are likely for other
applications. Using the ST_ExtractPixelCentroidValue4ma callback function
in a way similar to ST_ExtractToRaster you can resample overlapping
coverage :-) See Objective FV.27 from the specs. Most of it is in
ST_ExtractToRaster(). I guess we just need a new signature to extract from
a raster coverage instead of a vector coverage. See also
ST_GlobalRasterUnion() just after ST_ExtractToRaster() which is an
alternative to ST_Union using the raster callback methods.
--
Ticket URL: <http://trac.osgeo.org/postgis/ticket/2247#comment:13>
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-tickets
mailing list