Skip to content

Instantly share code, notes, and snippets.

@knutole
Created May 31, 2016 13:35
Show Gist options
  • Save knutole/cf4967faae4c15233c38d709602cbb8e to your computer and use it in GitHub Desktop.
Save knutole/cf4967faae4c15233c38d709602cbb8e to your computer and use it in GitHub Desktop.
WITH first AS (
SELECT id, (ST_Intersection(rast, rast, 0)).val
FROM file_caolvkddzzlgmvyeofrh
INNER JOIN file_xbwnbydpmwesokzmrcht ON ST_Intersects(rast, rast, 0)
)
SELECT id, COUNT(val), SUM(val), AVG(val), stddev(val), MIN(val), MAX(val)
FROM first
GROUP BY id;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment