[postgis-devel] [PostGIS] #1276: 2 band ST_MapAlgebraExpr crash

PostGIS trac at osgeo.org
Tue Nov 8 18:14:36 PST 2011


#1276: 2 band ST_MapAlgebraExpr crash
----------------------------+-----------------------------------------------
 Reporter:  robe            |       Owner:  pracine      
     Type:  defect          |      Status:  new          
 Priority:  blocker         |   Milestone:  PostGIS 2.0.0
Component:  postgis raster  |     Version:  trunk        
 Keywords:                  |  
----------------------------+-----------------------------------------------
 Bborie,

 Now I remember the input that I was able to use to make mapalebra crash.


 {{{
 --Create a cool set of rasters --
 CREATE TABLE fun_shapes(rid serial PRIMARY KEY, fun_name text, rast
 raster);

 -- Insert some cool shapes around Boston in Massachusetts state plane
 meters --
 INSERT INTO fun_shapes(fun_name, rast)
 VALUES ('ref', ST_AsRaster(ST_MakeEnvelope(235229, 899970, 237229,
 901930,26986),200,200,'8BUI',0,0));

 INSERT INTO fun_shapes(fun_name,rast)
 WITH ref(rast) AS (SELECT rast FROM fun_shapes WHERE fun_name = 'ref' )
 SELECT 'area' AS fun_name,
 ST_AsRaster(ST_Buffer(ST_SetSRID(ST_Point(236229, 900930),26986), 1000),
                         ref.rast,'8BUI', 118, 0) As rast
 FROM ref
 UNION ALL
 SELECT 'rand bubbles',
                         ST_AsRaster(
                         (SELECT ST_Collect(geom)
         FROM (SELECT ST_Buffer(ST_SetSRID(ST_Point(236229 +
 i*random()*100, 900930 + j*random()*100),26986), random()*20) As geom
                         FROM generate_series(1,10) As i,
 generate_series(1,10) As j
                         ) As foo ), ref.rast,'8BUI', 100, 0)
 FROM ref;

 -- this works okay --
 SELECT  st_mapalgebraexpr(
                 area.rast, bub.rast, 'rast1', NULL, 'INTERSECTION')
 FROM
   (SELECT rast FROM fun_shapes WHERE
  fun_name = 'area') As area
 CROSS JOIN  (SELECT rast FROM fun_shapes WHERE
  fun_name = 'rand bubbles') As bub;

 -- this crashes --
 SELECT  st_mapalgebraexpr(
                 area.rast, bub.rast, '((rast1*2 +
 rast2*18)/20.0)::integer', '8BUI', 'UNION', '0', 'rast1')
 FROM
   (SELECT rast FROM fun_shapes WHERE
  fun_name = 'area') As area
 CROSS JOIN  (SELECT rast FROM fun_shapes WHERE
  fun_name = 'rand bubbles') As bub

 }}}

 As far as I can tell its my constant '0' which is doing it.

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