[postgis-tickets] [PostGIS] #2237: ST_Resize fails with weird RAISE if dimensions not integer

PostGIS trac at osgeo.org
Sun Mar 17 14:41:18 PDT 2013


#2237: ST_Resize fails with weird RAISE if dimensions not integer
----------------------+-----------------------------------------------------
 Reporter:  robe      |       Owner:  pramsey      
     Type:  defect    |      Status:  new          
 Priority:  critical  |   Milestone:  PostGIS 2.1.0
Component:  postgis   |     Version:  trunk        
 Keywords:            |  
----------------------+-----------------------------------------------------
 I think this may be a bug in our RAISE notice or something:

 Getting this error:

 {{{
 ERROR:  too few parameters specified for RAISE
 CONTEXT:  PL/pgSQL function st_resize(raster,double precision,double
 precision,text,double precision) line 8 at RAISE
 }}}

 and always happens if I'm trying to scale (not using percents) but some
 multiple of width and height that does not result in integer.

 To replicate create table:

 {{{

 CREATE SCHEMA ch07;
 CREATE TABLE ch07.bag_o_rasters(
    rid serial primary key
  , rast_name text, rast raster);


 INSERT INTO ch07.bag_o_rasters(rast_name, rast)
 WITH a1 AS (   -- <co id="co_geom_st_asraster_fixed_1" /> --
  SELECT
   ST_Buffer(ST_GeomFromText('LINESTRING(448252 5414206,448289 5414317
   ,448293 5414330,448324 5414417,448351 5414495)', 32631), 10)
   As geom )
 SELECT 'squished road', ST_AsRaster(geom,50,500)
 FROM a1 ;
 }}}

 -- try to resize
 -- This fails
 {{{
 SELECT ST_Resize(rast,ST_Width(rast)*1.5, ST_Height(rast)*1.5)
 FROM ch07.bag_o_rasters
 WHERE rast_name = 'squished road'
 }}}


 -- This works
 {{{
 SELECT ST_Resize(rast,(ST_Width(rast)*1.5)::integer,
 (ST_Height(rast)*1.5)::integer )
 FROM ch07.bag_o_rasters
 WHERE rast_name = 'squished road'
 }}}

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