Skip to content

Instantly share code, notes, and snippets.

@fitnr
Created June 28, 2017 19:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fitnr/f7695ad3ff1d97fdeb6c18fa36ee956d to your computer and use it in GitHub Desktop.
Save fitnr/f7695ad3ff1d97fdeb6c18fa36ee956d to your computer and use it in GitHub Desktop.
simple SQL clipping for four sections of US: Alaska, contiguous states, Hawaii, and Puerto Rico & the USVI.
SELECT * FROM table WHERE (
(
lat > 51 AND lat < 71.5
AND ((
lon > -180 AND lon < -129
) OR (
lon > 172 AND lon < 180
))
) OR (
lat > 24 AND lat < 49.5
AND lon > -125 AND lon < -66.5
) OR (
lat > 18.5 AND lat < 29
AND lon > -178 AND lon < -155
) OR (
lat > 17.5 AND lat < 19
AND lon > -68 AND lon < -64
)
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment