[postgis-users] Create new table from result of MapAlgebra

Puneet Kishor punk.kish at gmail.com
Thu Apr 26 05:50:11 PDT 2012




On Apr 26, 2012, at 7:31 AM, JamesH <james.holmes at newcastle.ac.uk> wrote:

> Hello all,
> 
> I am wanting to create a new table from the result of a two raster
> mapalgebra calculation
> 
> SELECT
> ST_MapAlgebraExpr((ST_MapAlgebraExpr(a.rast,1, '32BF',
> '[rast]/67.6499557495117')), 1, 
>        (ST_MapAlgebraExpr(b.rast,1, '32BF', '[rast]/14052.134765265')), 1,
> '([rast1] * 0.5) + ([rast2] * 0.3)', '32BF')
> FROM density a, euclidean b;
> 
> Have tried 
> CREATE TABLE result AS(
> SELECT
> a.*, b.*, ST_MapAlgebraExpr((ST_MapAlgebraExpr(a.rast,1, '32BF',
> '[rast]/67.6499557495117')), 1, 
>        (ST_MapAlgebraExpr(b.rast,1, '32BF', '[rast]/14052.134765265')), 1,
> '([rast1] * 0.5) + ([rast2] * 0.3)', '32BF')
> FROM density a, euclidean b
> 
> But the problem is I am specifying rid more than once.
> What I would like it to have the result of the ST_MapAlgebra as the rast of
> a new Raster, but I am having difficulty.


Don't use a.*, b.*. Instead, explicitly specify the columns you want.


--
Puneet Kishor 



More information about the postgis-users mailing list