Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save rchardptrsn/ca587cf8ec2a801c2d8eda88f330db51 to your computer and use it in GitHub Desktop.
Save rchardptrsn/ca587cf8ec2a801c2d8eda88f330db51 to your computer and use it in GitHub Desktop.
create temp table from spatial join
CREATE TEMP TABLE fracking AS
SELECT f.name, f.operator, f.status, f.type, co.county
FROM fractracker f
JOIN co_counties co
ON ST_COVEREDBY(f.geom, co.geom);
-- query on TEMP TABLE to find count per county
SELECT county, COUNT(county) well_count
FROM fracking
GROUP BY county
ORDER BY well_count desc;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment