[postgis-tickets] [PostGIS] #2555: [raster]: ST_Reclass Working with negative numbers seems broken

PostGIS trac at osgeo.org
Sat Nov 30 21:15:57 PST 2013


#2555: [raster]: ST_Reclass Working with negative numbers seems broken
--------------------+-------------------------------------------------------
 Reporter:  robe    |       Owner:  dustymugs    
     Type:  defect  |      Status:  new          
 Priority:  medium  |   Milestone:  PostGIS 2.0.5
Component:  raster  |     Version:  2.0.x        
 Keywords:          |  
--------------------+-------------------------------------------------------

Comment(by dustymugs):

 Do you happen to have the source raster so that I can test it?

 The following seems to work for me.

 {{{
 WITH foo AS (
         SELECT
                 ST_SetValues(
                         ST_AddBand(
                                 ST_MakeEmptyRaster(3, 3, 0, 0, 1, -1, 0,
 0, 0),
                                 1, '32BF'::text
                         ),
                         1,
                         1, 1,
                         ARRAY[
                                 [-9000, -6000, -3000],
                                 [-3000, 0, 3000],
                                 [-3000, -6000, -9000]
                         ]::double precision[]
                 )       AS rast
 ), bar AS (
         SELECT
                 ST_Reclass(rast, 1, '[-9000-3000]:[-900-300]', '32BF') AS
 rast
         FROM foo
 )
 SELECT ST_DumpValues(rast) FROM foo
 UNION ALL
 SELECT ST_DumpValues(rast) FROM bar

                          st_dumpvalues
 ----------------------------------------------------------------
  (1,"{{-9000,-6000,-3000},{-3000,0,3000},{-3000,-6000,-9000}}")
  (1,"{{-900,-600,-300},{-300,0,300},{-300,-600,-900}}")
 }}}

-- 
Ticket URL: <http://trac.osgeo.org/postgis/ticket/2555#comment:2>
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-tickets mailing list