-
-
Save ian29/2814962 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
select | |
id, | |
sum(st_area((gval).geom) | |
/ 10000) as total_area_ha, | |
round( min((gval).val)) as min_slope, | |
round( sum((gval).val * st_area((gval).geom)) | |
/ st_area(st_collect((gval).geom)) | |
) as avg_slope_sqm, | |
round( max((gval).val)) as max_slope | |
from ( | |
select st_intersection(rast,1,db.the_geom) as gval, | |
db.the_geom, | |
db.gid as id | |
from slope2020 | |
inner join | |
(select | |
TABLE.gid, | |
TABLE.the_geom, | |
st_difference(development_bounds.the_geom - rivers_roads7.the_geom) as la) | |
--where target_use = 'Golf Area', 'Village C' | |
) as db | |
on | |
st_intersects(rast,db.the_geom) | |
) as foo | |
-- Here's the new line that lets you constrain the results to below a specified slope: | |
where (gval).val < 16 | |
-- End of new line. | |
group by id, foo.the_geom; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment