Database Reference
In-Depth Information
WITH r AS (
SELECT
ST_Transform(ST_Union(srtm.rast), 3310) AS rast
FROM srtm
JOIN sfpoly sf
ON
ST_DWithin(ST_Transform(srtm.rast::geometry,
3310), ST_Transform(sf.geom, 3310), 1000)
), cx AS (
SELECT
ST_AsRaster(ST_Transform(sf.geom, 3310),
r.rast) AS rast
FROM sfpoly sf
CROSS JOIN r
)
SELECT
ST_AsPNG(
ST_ColorMap(
ST_Clip(
ST_Slope(r.rast, 1, cx.rast),
ST_Transform(sf.geom, 3310)
),
'bluered'
)
) AS rast
FROM r
CROSS JOIN cx
CROSS JOIN sfpoly sf;
The "bluered" colormap sets the minimum, median, and maximum pixel values to
darkblue,palewhite,andbrightredrespectively.Pixelvaluesbetweentheminimum,
median,andmaximumvaluesareassignedcolorsthatarelinearlyinterpolatedfrom
the minimum to median or median to maximum range. The resulting image readily
shows where the steepest slopes in San Francisco are.
Search WWH ::




Custom Search