[postgis-users] Why so terribly slow?

Pierre Racine Pierre.Racine at sbf.ulaval.ca
Wed Feb 8 07:09:31 PST 2012


Hi David,

This is why we developed a series of map algebra functions. There is not much you cannot do them. Did you give them a try? You can create a new raster from one or two rasters using a SQL expression referring to the original raster pixel value or you can create a new raster for which each pixel value is computed from a moving window over the original raster (this is also called focal functions).

plpgsql functions working at the pixel level are definitely very slow as the raster have to be deserialised/reserialised for every pixel change. There is a ST_SetValues(rast, ARRAY[]) function planned that should speed up pixel edition but it will not make it in PostGIS 2.0. We are also thinking about  a ST_BurnToRaster(rast, geometry) that could burn the M or Z values of a multipoint geometry in a raster...

Pierre

> -----Original Message-----
> From: postgis-users-bounces at postgis.refractions.net [mailto:postgis-users-
> bounces at postgis.refractions.net] On Behalf Of DavidRA
> Sent: Wednesday, February 08, 2012 9:35 AM
> To: postgis-users at postgis.refractions.net
> Subject: [postgis-users] Why so terribly slow?
> 
> Hi everybody, I wanted to develop several PL/PGSQL functions in order to work
> with rasters but at the first try I found myself in trouble: working at pixel level
> results to be awfully slow.
> 
> For example, I created this VERY BASIC function that takes a raster and returns a
> copy of it made pixel by pixel:
> 
> 
> 
> Executed with a very small raster (width = 146, height = 253) it takes about
> 15 seconds, which would be slow but yet acceptable.
> 
> Executed with a "normal" raster (width = 1737, height = 1040) it takes...
> Who knows? I cancelled it before 2 hours.
> 
> 
> What could be the reason? Am I doing something wrong? I'd really appreciate a
> hand with this matter. Thanks!
> 
> --
> View this message in context: http://postgis.17.n6.nabble.com/Why-so-terribly-
> slow-tp4376157p4376157.html
> Sent from the PostGIS - User mailing list archive at Nabble.com.
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users



More information about the postgis-users mailing list