Skip to content

Instantly share code, notes, and snippets.

Last active Dec 10, 2015
What would you like to do?
Maptime Seattle Postgis - Problem 4
WITH county_hurricanes AS (
SELECT DISTINCT AS county_name, AS state_name, h.serial_num
FROM geo.counties_cb c
INNER JOIN geo.states_ne s ON c.statefp = right(s.fips, 2) --The FIPS codes in the state table have "US" infront of them, the right() function trims that
INNER JOIN weather.hurricane_lines_noaa h ON ST_Intersects(c.geom, h.geom)
WHERE s.admin = 'United States of America'
SELECT county_name, state_name, COUNT(*)
FROM county_hurricanes
GROUP BY county_name, state_name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment