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

David Quinn daithiquinn at gmail.com
Wed Feb 22 14:17:32 PST 2012


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20120222/ca731a93/attachment.html>


More information about the postgis-users mailing list