Created
August 11, 2021 02:31
-
-
Save mbforr/e0af2da4bd8506beb1239a16b189d9ee 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 | |
COUNT(b.full_name) AS interstates, | |
a.state_name, | |
ARRAY_AGG(b.full_name) AS roads | |
FROM | |
`bigquery-public-data.geo_us_boundaries.states` a | |
JOIN | |
`bigquery-public-data.geo_us_roads.us_national_roads` b | |
ON | |
st_contains(a.state_geom, | |
b.road_geom) | |
WHERE | |
b.full_name LIKE 'I-%' | |
AND st_LENGTH(b.road_geom) > 5000 | |
GROUP BY | |
a.state_name |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment