[postgis-devel] Another idea to speedup raster value editing
Sandro Santilli
strk at keybit.net
Wed Feb 1 00:52:38 PST 2012
I've been thinking that for my use case (create the NTv2 gridshift)
it would be fast to pass a measured MULTIPOINT geometry where X/Y
would address the pixel and M would set the value.
The same representation could be useful in output, to use in place
of ST_PixelAsPolygon.
Such function, implemented in C, would allow to set and get all values in
a band with a single raster deserialization.
Map algebra, btw, you could perform on the M values directly.
Something like:
WITH
pixels AS (
SELECT (ST_DumpPixelsAsPointM(rast)).geom FROM myrasttable
),
newpixels AS (
SELECT ST_Point(ST_X(geom),ST_Y(geom), ST_M(geom)+1) as geom
)
SELECT ST_SetValueFromPointM(rast, st_collect(geom) FROM newpixels;
How do you like it ?
--strk;
,------o-.
| __/ | Thank you for PostGIS-2.0 Topology !
| / 2.0 | http://www.pledgebank.com/postgistopology
`-o------'
More information about the postgis-devel
mailing list