[postgis-devel] Another idea to speedup raster value editing
Pierre Racine
Pierre.Racine at sbf.ulaval.ca
Wed Feb 1 07:49:18 PST 2012
The plan was to be able to provide an array and a X and a Y shift to know where to write the values from the array if the number of value provided is less than the actual number of pixels.
So SetValues(rast, ARRAY[1,2,3]) would edit the first three pixels and SetValues(rast, ARRAY[1,2,3], 2, 3) would edit the second, third and fourth pixels of the third row.
If the values you want to edit are a function of the existing values (or the values of another raster) and you want to edit all of them, use ST_MapAlgebra.
If the values are not a function of the existing values use ST_SetValues.
Pierre
> -----Original Message-----
> From: postgis-devel-bounces at postgis.refractions.net [mailto:postgis-devel-
> bounces at postgis.refractions.net] On Behalf Of Paul Ramsey
> Sent: Wednesday, February 01, 2012 10:28 AM
> To: PostGIS Development Discussion
> Subject: Re: [postgis-devel] Another idea to speedup raster value editing
>
> Kinda... but then you've got a multipoint to deal with and that's easier
> because...?
> How about just getting/taking an array?
> P.
>
> On Wed, Feb 1, 2012 at 12:52 AM, Sandro Santilli <strk at keybit.net> wrote:
> > 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------'
> >
> > _______________________________________________
> > postgis-devel mailing list
> > postgis-devel at postgis.refractions.net
> > http://postgis.refractions.net/mailman/listinfo/postgis-devel
> _______________________________________________
> postgis-devel mailing list
> postgis-devel at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-devel
More information about the postgis-devel
mailing list