Sunday, September 20, 2015
QspatiaLite Use Case: SpatiaLite Aggregation over Points within Polygons using the QspatiaLite Plugin
Here's a nice example for aggregation of points per polygon areas, which I grabbed from an Answer on SO, by user @Micha. The polygons could be regions of interest, a sampling grid, etc.Say you want to do maximum, minimum, averages, etc. per polygon using the spatial database SpatiaLite.
SELECT g.plgnID AS "plgn_ID",
AVG(s.pollution) AS "Average Pollution",
MAX(s.pollution) AS "Maximum Pollution",
COUNT(*) AS "Number of Sensors"
FROM sensors AS s JOIN SHAPE1 AS g
ON contains(g.geometry, s.geometry)
GROUP BY g.plgnID
Labels:
GIS,
QGIS,
QspatiaLite,
spatiaLite
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment