[postgis-devel] [PostGIS] #1537: [raster] Impossible to set the nodata value of a raster returned by ST_Intersection(raster, geometry, extenttype)

PostGIS trac at osgeo.org
Fri Feb 3 13:57:21 PST 2012


#1537: [raster] Impossible to set the nodata value of a raster returned by
ST_Intersection(raster, geometry, extenttype)
---------------------+------------------------------------------------------
 Reporter:  pracine  |       Owner:  pracine      
     Type:  defect   |      Status:  new          
 Priority:  medium   |   Milestone:  PostGIS 2.0.0
Component:  raster   |     Version:  trunk        
 Keywords:           |  
---------------------+------------------------------------------------------
 This is a strange bug.

 The first query shows the pixel type of the first band of the result of a
 ST_Intersection(raster, geometry, extent) operation:

 {{{
 SELECT ST_BandPixelType(
           ST_Intersection(ST_AddBand(ST_MakeEmptyRaster(2, 2, 0, 0, 0.001,
 -0.001, 0, 0, 4269), '8BSI'::text, 0, -2),
                           ST_AddBand(ST_MakeEmptyRaster(2, 2, 0, 0, 0.001,
 -0.001, 0, 0, 4269), '8BSI'::text, 0, -2)::geometry,
                           'SECOND'), 1);
 }}}

 The pixel type is '8BSI' so I should be able to reset the nodata value of
 the resulting raster to whatever between -128 and 127 (say -3) but I can't
 set it to something smaller than 0:

 {{{
 SELECT ST_BandNodataValue(
         ST_SetBandNodataValue(
           ST_Intersection(ST_AddBand(ST_MakeEmptyRaster(2, 2, 0, 0, 0.001,
 -0.001, 0, 0, 4269), '8BSI'::text, 0, -2),
                           ST_AddBand(ST_MakeEmptyRaster(2, 2, 0, 0, 0.001,
 -0.001, 0, 0, 4269), '8BSI'::text, 0, -2)::geometry,
                           'SECOND'), -3));
 }}}

 If I try to set it to something greater than -1 it works:

 {{{
 SELECT ST_BandNodataValue(
         ST_SetBandNodataValue(
           ST_Intersection(ST_AddBand(ST_MakeEmptyRaster(2, 2, 0, 0, 0.001,
 -0.001, 0, 0, 4269), '8BSI'::text, 0, -2),
                           ST_AddBand(ST_MakeEmptyRaster(2, 2, 0, 0, 0.001,
 -0.001, 0, 0, 4269), '8BSI'::text, 0, -2)::geometry,
                           'SECOND'), 15))
 }}}

 and if I set the extent of the result of the intersection to 'FIRST' I can
 do what I want:

 {{{
 SELECT ST_BandNodataValue(
         ST_SetBandNodataValue(
           ST_Intersection(ST_AddBand(ST_MakeEmptyRaster(2, 2, 0, 0, 0.001,
 -0.001, 0, 0, 4269), '8BSI'::text, 0, -2),
                           ST_AddBand(ST_MakeEmptyRaster(2, 2, 0, 0, 0.001,
 -0.001, 0, 0, 4269), '8BSI'::text, 0, -2)::geometry,
                           'FIRST'), -15))
 }}}

 There might be something I don't get here...

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