[postgis-users] Reclassify a Slope Surface

Pierre Racine Pierre.Racine at sbf.ulaval.ca
Tue Apr 10 10:03:55 PDT 2012


> I am trying to reclassify a slope surface with a reverse normalisation (lower the
> slope value, the closer to 1 it becomes).
> 
> It can be done in ArcGIS in the Raster Calculator using:
> (0.404234915971756 - "slope") / 0.404234915971756 where
> 0.404234915971756 is the maximum value (minimum value of the data is zero so
> I don't need to include this in the calculation).
> 
> Wanting to recreate this process in PostGIS so can anyone advise on how I could
> do the calculation for:
> (max. value - cell value)/ max. value for each cell in the raster?
> Cannot get my head around it.

1) Compute the slope with ST_Slope()

2) Determine the max slope value with ST_SummaryStat()

3) Normalize with ST_MapAlgebraExpr()

You can eventually do all that in one complex query.

And read the doc:

http://postgis.refractions.net/documentation/manual-svn/RT_reference.html

Pierre





More information about the postgis-users mailing list