[postgis-users] Raster pixel value

Tom van Tilburg tom.van.tilburg at gmail.com
Mon Dec 19 02:14:07 PST 2011


Divisions by zero shouldn't happen as far as I know, at most it should 
give you null data as return.

Sounds like a bug.
Perhaps you can check:
http://trac.osgeo.org/postgis/browser/trunk/raster/scripts/plpgsql/st_summarystatsagg.sql

at line 69 it says: "($1).sum / ($1).count"
my guess is that that's where the division by 0 happens.
(it means probably that there is an empty raster somewhere in your 
results that consequently leads to count() = 0 )

You can find the same code in your database functions ofcourse.

Good luck!
  Tom

On 19-12-2011 10:53, Andreas Forø Tollefsen wrote:
> Updated to latest trunk, and now it works.
> However, I ran into a new "division by zero" error. This halts the query.
> Could it be that something is divided by integer rather than decimal 
> in the query, or what else causes this:
>
> ERROR:  division by zero
> CONTEXT:  PL/pgSQL function "raster_summarystatsfinal" line 5 at 
> assignment
>
> ********** Error **********
>
> ERROR: division by zero
> SQL state: 22012
> Context: PL/pgSQL function "raster_summarystatsfinal" line 5 at assignment
>
> Best,
> Andreas




More information about the postgis-users mailing list