Database Reference
In-Depth Information
•
ST_Transform()
: This method converts the geometry's coordinates from
onespatialreferencesystemtoanother.Transformingageometryistypically
fasterthantransformingaraster.Transformingarasterrequiresresampling
thepixelvalues,acomputationally-intensive processandonethatcouldin-
troduceundesirableresults.Ifpossible,alwaystransformageometrybefore
transforming a raster.
•
ST_Intersects()
:The
ST_Intersects()
methodfoundinthe
JOIN ON
clause tests whether the raster tile and the geometry spatially intersect. It
willuseanyavailablespatialindexes.Dependingontheinstalledversionof
PostGIS,
ST_Intersects()
will implicitly convert the input geometry to a
raster (PostGIS 2.0) or the input raster to a geometry (PostGIS 2.1) before
comparing the two inputs.
•
ST_Clip()
:Thismethodtrimseachintersectingrastertileonlytothearea
thatintersectsthegeometry.Iteliminatesthepixelsthatarenotspatiallypart
ofthegeometry.Aswith
ST_Intersects()
,thegeometryisimplicitlycon-
verted to a raster before clipping.
•
ST_Union()
: This method aggregates and merges the clipped raster tiles
into one raster for further processing.
The following output shows the average minimum temperature for San Francisco:
mean------------------7.35125005245209
SanFranciscowasreallycoldinJanuary,2012.So,howdoestherestof2012look?
Is San Francisco always cold?
SELECT
prism.month_year, (
ST_SummaryStats(
ST_Union(
ST_Clip(prism.rast, 2,
ST_Transform(sf.geom, 4322), TRUE)
),
1
)