Database Reference
In-Depth Information
If PostGIS 2.0 is available, we can still use 2.0's ST_Slope() and
ST_HillShade() to create slope and hillshade rasters. But there are several dif-
ferences you need to be aware of, as follows:
ST_Slope() and ST_Aspect() return a raster with values in radians in-
stead of degrees
• Some input parameters of ST_HillShade() are expressed in radians in-
stead of degrees
• The computed raster from ST_Slope() , ST_Aspect() , or
ST_HillShade() has an empty 1-pixel border on all four sides
Wecanadaptour ST_Slope() queryfromthebeginningofthisrecipebyremoving
the creation and application of the custom extent. Since the custom extent con-
strainedthecomputationtoaspecificarea,theinabilitytospecifysuchaconstraint
means PostGIS 2.0's ST_Slope() will perform slower.
WITH r AS ( -- union of filtered tiles
SELECT
ST_Transform(ST_Union(srtm.rast), 3310) AS rast
FROM srtm
JOIN sfpoly sf
ON
ST_DWithin(ST_Transform(srtm.rast::geometry, 3
310), ST_Transform(sf.geom, 3310), 1000)
)
SELECT
ST_Clip(ST_Slope(r.rast, 1),
ST_Transform(sf.geom, 3310)) A
S rast
FROM r
CROSS JOIN sfpoly sf;
How it works...
TheDEMfunctionsinPostGISallowedustoquicklyanalyzeourSRTMraster.Inthe
basic use cases, we were able toswap one function for another without any issues.
Search WWH ::




Custom Search