[postgis-devel] [PostGIS] #1536: [raster] There should be an option for certain variants of ST_Intersection(raster, raster)

PostGIS trac at osgeo.org
Fri Feb 3 11:10:23 PST 2012


#1536: [raster] There should be an option for certain variants of
ST_Intersection(raster, raster)
---------------------+------------------------------------------------------
 Reporter:  pracine  |       Owner:  pracine      
     Type:  defect   |      Status:  new          
 Priority:  low      |   Milestone:  PostGIS 2.0.0
Component:  raster   |     Version:  trunk        
 Keywords:           |  
---------------------+------------------------------------------------------
 All the variants of ST_Intersection accepting a extenttype argument should
 also allow to define a nodata value in case the input raster do not have
 one defined.

 Otherwise it leads to strange results like this:

 {{{
 SELECT ST_AsBinary((gv).geom) geom,  (gv).val
 FROM (SELECT ST_PixelAsPolygons(
            ST_Intersection(ST_AddBand(ST_MakeEmptyRaster(48, 63, 0, 0,
 0.001, -0.001, 0, 0, 4269), '32BF'::text, 0, NULL),
                            ST_AddBand(ST_MakeEmptyRaster(48, 63, 0.1, 0.1,
 0.001, -0.001, 0, 0, 4269), '32BF'::text, 0, NULL)::geometry,
                            'SECOND')) gv) foo;
 }}}

 in which:

 -the first raster do not have a nodata value defined,

 -the second parameter is just a dummy geometry to 'cut' the first raster,

 -we want the result to cover the extent of the geometry ('SECOND')

 so that we should get a lower left rectangle filled with zeros (0) and the
 rest of the extent filled with nodata.

 Instead we get just nodata :-(

 If ST_Intersection(raster, geometry, extenttype) would allow me to pass a
 nodata value, then I could make sure a correct nodata value is chosen and
 hence not annihilating my data.

 On the same track, why do the variants of ST_Intersection() taking a
 geometry allow me to define the resulting extent but not the variant
 taking two rasters? Actually why does the one taking a geometry allows me
 to define the resulting extent at all? This is an intersection operation,
 the result should always cover just the intersection. If I want something
 more sophisticated I should use ST_MapAlgebra(raster, raster).

 I'm working on a ST_Tile() plpgsql prototype using ST_Clip() and
 ST_Intersection(raster, geometry)...

-- 
Ticket URL: <http://trac.osgeo.org/postgis/ticket/1536>
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