Skip to content

Instantly share code, notes, and snippets.

@eightysteele
Created February 20, 2014 00:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eightysteele/9104402 to your computer and use it in GitHub Desktop.
Save eightysteele/9104402 to your computer and use it in GitHub Desktop.
SELECT SUM(count) as value, 'FORMA' as name,
'alerts' as unit, '500 meters' as resolution
FROM
(SELECT COUNT(*) AS count
FROM forma_api
WHERE date <= now() - INTERVAL '1 Months'
AND ST_INTERSECTS(ST_SetSRID(ST_GeomFromGeoJSON('{"coordinates": [[[["22.5000", "3.3380"], ["21.9727", "-7.8851"], ["32.8711", "1.7575"]]]], "type": "MultiPolygon"}'), 4326),
the_geom)
GROUP BY date, iso
ORDER BY iso, date) AS alias
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment