Created
August 9, 2015 16:57
-
-
Save giacecco/9f6c5da3be1b3ed6d32d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DROP VIEW IF EXISTS lr_pp_town_definition; | |
CREATE VIEW lr_pp_town_definition AS | |
SELECT a.town, ST_MakeEnvelope(MIN(ST_X(b.geom)), MIN(ST_Y(b.geom)), MAX(ST_X(b.geom)), MAX(ST_Y(b.geom)), 4326) AS bounding_box | |
FROM | |
(SELECT DISTINCT town, pcd FROM lr_pp) AS a | |
LEFT JOIN | |
(SELECT pcd, geom FROM ons_pd WHERE doterm IS NULL) AS b | |
ON a.pcd = b.pcd | |
GROUP BY town; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment