[postgis-users] ST_Mapalgebraexpr requires same alignment
Hi. Im trying to use mapalgebra between two layers with tiles, I get this warning: NOTICE: The two rasters provided do not have the same alignment. Returning NULL The resulted tiles are empty. Does ST_Mapalgebraexpr require same alignment? According to the docs I guess not but then dont know why im getting that message. In another example I didnt use st_union with the same result. insert into demdif (rast) select st_mapalgebraexpr (d1.rast, 1, st_union (d2.rast), 1, 'abs([rast1.val] - [rast2-val])','16BSI', 'FIRST', null, null,null) from dem200 d1, dem d2 where d1.rast && d2.rast and st_relate (d1.rast::geometry, d2.rast::geometry, 'T') group by d1.rid; Another issue is st_union (internally is st_mapalgebraexpr) is extremely slow. I can not manage raster layers bigger than a couple of thousand pixel in x or y even with 128 tiled blocks. Jose ___ postgis-users mailing list postgis-users@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users
Re: [postgis-users] ST_Mapalgebraexpr requires same alignment
Hi again, I still dont know why Im getting 'NOTICE: The two rasters provided do not have the same alignment. Returning NULL ' with ST_Mapalgrebra. Im kind of stuck. Any help would be appreciated. On 22/03/2012 18:00, Jose Carlos Martinez wrote: Hi. Im trying to use mapalgebra between two layers with tiles, I get this warning: NOTICE: The two rasters provided do not have the same alignment. Returning NULL The resulted tiles are empty. Does ST_Mapalgebraexpr require same alignment? According to the docs I guess not but then dont know why im getting that message. In another example I didnt use st_union with the same result. insert into demdif (rast) select st_mapalgebraexpr (d1.rast, 1, st_union (d2.rast), 1, 'abs([rast1.val] - [rast2-val])','16BSI', 'FIRST', null, null,null) from dem200 d1, dem d2 where d1.rast && d2.rast and st_relate (d1.rast::geometry, d2.rast::geometry, 'T') group by d1.rid; Another issue is st_union (internally is st_mapalgebraexpr) is extremely slow. I can not manage raster layers bigger than a couple of thousand pixel in x or y even with 128 tiled blocks. Jose ___ postgis-users mailing list postgis-users@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users ___ postgis-users mailing list postgis-users@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users
Re: [postgis-users] ST_Mapalgebraexpr requires same alignment
> The resulted tiles are empty. Does ST_Mapalgebraexpr require same alignment? > According to the docs I guess not but then dont know why im getting that > message. What in the doc let you think that it does not require same alignment? Is does... > In another example I didnt use st_union with the same result. > > insert into demdif (rast) select st_mapalgebraexpr (d1.rast, 1, st_union > (d2.rast), > 1, 'abs([rast1.val] - [rast2-val])','16BSI', 'FIRST', null, > null,null) from dem200 d1, dem d2 where d1.rast && d2.rast and st_relate > (d1.rast::geometry, d2.rast::geometry, 'T') group by d1.rid; > > Another issue is st_union (internally is st_mapalgebraexpr) is extremely > slow. I > can not manage raster layers bigger than a couple of thousand pixel in x or y > even with 128 tiled blocks. Right. This is documented: http://postgis.org/documentation/manual-svn/RT_ST_Union.html Pierre ___ postgis-users mailing list postgis-users@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users
Re: [postgis-users] ST_Mapalgebraexpr requires same alignment
Hi Pierre, thanx for the answer. I though same alignment was not required because the docs said the alignment is chosen from first raster, then I guessed the second raster could have different alignment. I guessed it can support different alignment because otherwise I think its very limited, maybe Im doing something wrong though but the normal scenario its to make spatial analysis with raster which have different alignment. How can I rewrite the sentence with raster which have different alignment? or I should re-sample the whole raster to make them to have the same alignment? insert into demdif (rast) select st_mapalgebraexpr (d1.rast, 1, st_union (d2.rast), 1, 'abs([rast1.val] - [rast2-val])','16BSI', 'FIRST', null, null,null) from dem200 d1, dem d2 where d1.rast && d2.rast and st_relate (d1.rast::geometry, d2.rast::geometry, 'T') group by d1.rid; On 23/03/2012 14:02, Pierre Racine wrote: The resulted tiles are empty. Does ST_Mapalgebraexpr require same alignment? According to the docs I guess not but then dont know why im getting that message. What in the doc let you think that it does not require same alignment? Is does... In another example I didnt use st_union with the same result. insert into demdif (rast) select st_mapalgebraexpr (d1.rast, 1, st_union (d2.rast), 1, 'abs([rast1.val] - [rast2-val])','16BSI', 'FIRST', null, null,null) from dem200 d1, dem d2 where d1.rast&& d2.rast and st_relate (d1.rast::geometry, d2.rast::geometry, 'T') group by d1.rid; Another issue is st_union (internally is st_mapalgebraexpr) is extremely slow. I can not manage raster layers bigger than a couple of thousand pixel in x or y even with 128 tiled blocks. Right. This is documented: http://postgis.org/documentation/manual-svn/RT_ST_Union.html Pierre ___ postgis-users mailing list postgis-users@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users ___ postgis-users mailing list postgis-users@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users
Re: [postgis-users] ST_Mapalgebraexpr requires same alignment
> I though same alignment was not required because the docs said the alignment > is chosen from first raster, then I guessed the second raster could have > different > alignment. I guessed it can support different alignment because otherwise I > think its very limited, maybe Im doing something wrong though but the normal > scenario its to make spatial analysis with raster which have different > alignment. I agree that the doc is not that clear. I took a note. > How can I rewrite the sentence with raster which have different alignment? or > I > should re-sample the whole raster to make them to have the same alignment? > > insert into demdif (rast) select st_mapalgebraexpr (d1.rast, 1, st_union > (d2.rast), > 1, 'abs([rast1.val] - [rast2-val])','16BSI', 'FIRST', null, > null,null) from dem200 d1, dem d2 where d1.rast && d2.rast and st_relate > (d1.rast::geometry, d2.rast::geometry, 'T') group by d1.rid; I understand that they are in the same SRID but not aligned. This is two different things. It all depends if your raster table is tiled or not. If it's not tiled just ST_Resample(rast, ref) before passing to ST_MapAlgebra(). If it is tiled, resampling generate much overlapping nodata values. PostGIS Raster normally deal well with that but it generates much useless nodata value processing. I would suggest to merge outside, resample/reproject with GDAL and reload tiled. Pierre ___ postgis-users mailing list postgis-users@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users
Re: [postgis-users] ST_Mapalgebraexpr requires same alignment
On 23/03/2012 15:59, Pierre Racine wrote: I though same alignment was not required because the docs said the alignment is chosen from first raster, then I guessed the second raster could have different alignment. I guessed it can support different alignment because otherwise I think its very limited, maybe Im doing something wrong though but the normal scenario its to make spatial analysis with raster which have different alignment. I agree that the doc is not that clear. I took a note. How can I rewrite the sentence with raster which have different alignment? or I should re-sample the whole raster to make them to have the same alignment? insert into demdif (rast) select st_mapalgebraexpr (d1.rast, 1, st_union (d2.rast), 1, 'abs([rast1.val] - [rast2-val])','16BSI', 'FIRST', null, null,null) from dem200 d1, dem d2 where d1.rast&& d2.rast and st_relate (d1.rast::geometry, d2.rast::geometry, 'T') group by d1.rid; I understand that they are in the same SRID but not aligned. This is two different things. Yes they have same SRID It all depends if your raster table is tiled or not. If it's not tiled just ST_Resample(rast, ref) before passing to ST_MapAlgebra(). If it is tiled, resampling generate much overlapping nodata values. PostGIS Raster normally deal well with that but it generates much useless nodata value processing. I would suggest to merge outside, resample/reproject with GDAL and reload tiled. The raster tables are all tiled. Im wondering why st_mapalgebra can not work with no alignment rasters, maybe because it is working with pixel coordinates instead of terrain coordinates?..probably im wrong its just a guess. If the user makes sure the rast2 is covering completely rast1 I dont understand why it needs same alignment. ummm...there is some plans about future releases to work with not alignment rasters? to be honest I think this is a limitation in order to to carry out a normal raster spatial analysis. :-(. I will try to use postgis raster without this feature though. thanks Pierre Pierre ___ postgis-users mailing list postgis-users@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users ___ postgis-users mailing list postgis-users@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users
Re: [postgis-users] ST_Mapalgebraexpr requires same alignment
On Fri, Mar 23, 2012 at 8:16 AM, Jose Carlos Martinez wrote: > ummm...there is some plans about future releases to work with not alignment > rasters? to be honest I think this is a limitation in order to to carry out > a normal raster spatial analysis. :-(. I will try to use postgis raster > without this feature though. I don't think it's unreasonable to expect that inputs to mapalgebras be on the same alignment. I do thing that utilities for re-sampling whole tables need to exist to that it's possible to run full analyses inside the database, but I think requiring alignment for mapalgebra will solve more problems (in terms of people getting the results they "expect") than trying to plaster over it with automagical code. P. ___ postgis-users mailing list postgis-users@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users
Re: [postgis-users] ST_Mapalgebraexpr requires same alignment
On 23/03/2012 17:12, Paul Ramsey wrote: On Fri, Mar 23, 2012 at 8:16 AM, Jose Carlos Martinez wrote: ummm...there is some plans about future releases to work with not alignment rasters? to be honest I think this is a limitation in order to to carry out a normal raster spatial analysis. :-(. I will try to use postgis raster without this feature though. I don't think it's unreasonable to expect that inputs to mapalgebras be on the same alignment. I do thing that utilities for re-sampling whole tables need to exist to that it's possible to run full analyses inside the database, but I think requiring alignment for mapalgebra will solve more problems (in terms of people getting the results they "expect") than trying to plaster over it with automagical code. I m not sure If i understand you because of english but what Im 100% sure is that any person who has made raster spatial analysis with real data knows that map algebra must work with raster with different alignment as other software do. The normal thing if I have raster layers from different sources is that they dont have same alignment, as I said so for any raster software that I know can work with these kind of data, thats why Im guessing PostGIS raster is working with pixels and not with terrain coordinates (but maybe Im wrong). Please dont think in a computer science expertise way and think as if you were a geographer who just want to mix two raster layers and dont mind if they layers have same alignment or not. Otherwise people are going to keep using sextante, arcgis, grass, etc. instead of PostGIS Raster. P. ___ postgis-users mailing list postgis-users@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users ___ postgis-users mailing list postgis-users@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users
Re: [postgis-users] ST_Mapalgebraexpr requires same alignment
Following Pierre notes I can do (note st_resample): s1=# insert into demdif (rast) select st_mapalgebraexpr (d1.rast, 1, st_resample (st_union (d2.rast), d1.rast), 1, 'abs([rast1.val] + [rast2.val])','16BSI', 'FIRST', null, null,null) from dem200 d1, dem d2 where d1.rast && d2.rast and st_relate (d1.rast::geometry, d2.rast::geometry, 'T') group by d1.rid; Its not the best way to do but at least we can mix different layers. Thanks Pierre, Jose On 23/03/2012 17:32, Jose Carlos Martinez wrote: On 23/03/2012 17:12, Paul Ramsey wrote: On Fri, Mar 23, 2012 at 8:16 AM, Jose Carlos Martinez wrote: ummm...there is some plans about future releases to work with not alignment rasters? to be honest I think this is a limitation in order to to carry out a normal raster spatial analysis. :-(. I will try to use postgis raster without this feature though. I don't think it's unreasonable to expect that inputs to mapalgebras be on the same alignment. I do thing that utilities for re-sampling whole tables need to exist to that it's possible to run full analyses inside the database, but I think requiring alignment for mapalgebra will solve more problems (in terms of people getting the results they "expect") than trying to plaster over it with automagical code. I m not sure If i understand you because of english but what Im 100% sure is that any person who has made raster spatial analysis with real data knows that map algebra must work with raster with different alignment as other software do. The normal thing if I have raster layers from different sources is that they dont have same alignment, as I said so for any raster software that I know can work with these kind of data, thats why Im guessing PostGIS raster is working with pixels and not with terrain coordinates (but maybe Im wrong). Please dont think in a computer science expertise way and think as if you were a geographer who just want to mix two raster layers and dont mind if they layers have same alignment or not. Otherwise people are going to keep using sextante, arcgis, grass, etc. instead of PostGIS Raster. P. ___ postgis-users mailing list postgis-users@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users ___ postgis-users mailing list postgis-users@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users ___ postgis-users mailing list postgis-users@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users