[postgis-devel] [PostGIS] #590: [raster] Two rasters version of ST_MapAlgebra

PostGIS trac at osgeo.org
Mon Oct 24 07:03:29 PDT 2011


#590: [raster] Two rasters version of ST_MapAlgebra
----------------------------+-----------------------------------------------
 Reporter:  pracine         |       Owner:  dustymugs    
     Type:  task            |      Status:  assigned     
 Priority:  critical        |   Milestone:  PostGIS 2.0.0
Component:  postgis raster  |     Version:  trunk        
 Keywords:                  |  
----------------------------+-----------------------------------------------

Comment(by pracine):

 Replying to [comment:15 bnordgren]:
 >  1. There is no reason whatsoever to assume that the two bands passed to
 this function come from the same table (and hence are imagined to be
 aligned for some special case). In fact, it will probably be common to
 combine tiles from different images.

 Right. This is why I planned that ST_MapAlgebra would implicitely
 resample. However nothing prevent us from forcing users to make explicit
 this resampling:

 SELECT ST_Mapalgebra(rast1, ST_Resample(rast2, rast1), expr,
 'INTERSECTION')
 FROM cov1, cov2
 WHERE ST_Intersects(rast1, rast2)

 Are we losing performance here?

 >  1. There is nothing (and should be nothing) requiring rasters from the
 same table to be aligned (or even to have the same SRID). The data in the
 raster_columns table is informative, not normative. As Pierre once told
 me, there is no guarantee that someone didn't insert a rogue raster and
 mess up your nice table. If you are in fact shooting for "one table per
 logical theme", you'd better allow for that theme to be global and the
 table to contain all the UTM zones. One table per theme per UTM zone is
 insanity personified. Perhaps this should be broken off as a separate
 discussion. Is there any code which actually depends on all tiles in an
 individual table being of the same SRID and aligned?

 PostGIS in general assume that all the geometry in one table are of the
 same SRID. PostGIS DO NOT reproject geometries having different SRID in
 spatial relationship functions (like ST_Intersection). I think it is wise
 to follow the same rule (We do not reproject rasters when performing
 spatial operation between two raster having different SRID).

 The question we have to solve, since this is specific to raster, is
 "Should we resample implicitely when needed?" This is also the first time
 we are facing the issue since this is the first function involving two
 rasters (the question should have raised for ST_Intersects(raster, raster)
 however. Bborie, does that mean that it is possible for two rasters being
 resampled differently to return a different result for ST_Intersects()?).
 For sure there should be a warning if implicit resampling is performed.

-- 
Ticket URL: <https://trac.osgeo.org/postgis/ticket/590#comment:16>
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-devel mailing list