[postgis-users] raster::precision error in query

Pierre Racine Pierre.Racine at sbf.ulaval.ca
Wed Feb 22 14:22:36 PST 2012


You must have a old version of ST_Clip. 'rast1' has now been replaced with '[rast1.val]'. 

Update and make sure you don't have old versions of the function.

Pierre

> -----Original Message-----
> From: postgis-users-bounces at postgis.refractions.net [mailto:postgis-users-
> bounces at postgis.refractions.net] On Behalf Of David Quinn
> Sent: Wednesday, February 22, 2012 5:18 PM
> To: PostGIS Users Discussion
> Subject: [postgis-users] raster::precision error in query
> 
> I'm getting the following error from a query that I'm running on a raster and
> polygon:
> 
> pg_query() [<a href='function.pg-query'>function.pg-query</a>]: Query failed:
> ERROR:  column "rast1" does not exist LINE 1: SELECT
> (rast1)::double precision
>                 ^
> QUERY:  SELECT (rast1)::double precision
> CONTEXT:  PL/pgSQL function "st_clip" line 42 at assignment in
> 'filename'.
> 
> My query is as follows:
> 
> SELECT
>             band,
>             SUM((stats).sum) as sum,
>             SUM((stats).count) as count,
>             AVG((stats).mean) as avg
>         FROM (
>                 SELECT
>                     band,
>                     ST_SummaryStats(ST_Clip(r.rast, band,p.geom, NULL, TRUE)) as stats
>                 FROM
>                     generate_series(1,5) AS band,
>                     raster AS r
>                     polygon AS p
>                 WHERE
>                     ST_Intersects(r.rast, p.geom)
>                 ) AS
>                     foo
>                   GROUP BY
>                       band
>                   ORDER BY
>                       band;
> 
> I did recently upgrade  to the newest version of PostGIS on Windows,  but I'm
> not certain if this is the cause. I'm most unclear about the part: "(rast1)::double
> precision" Do I need to be specifying the type of raster in the query? The values
> are all integers in this case.
> 
> Thanks,
> David




More information about the postgis-users mailing list