Skip to content

Instantly share code, notes, and snippets.

@mbforr
Created July 11, 2021 01:03
Show Gist options
  • Save mbforr/d214be002f6edb4e1fbc8994873f31de to your computer and use it in GitHub Desktop.
Save mbforr/d214be002f6edb4e1fbc8994873f31de to your computer and use it in GitHub Desktop.
select
state_name,
# first, we create the centroid for each state
# then using the buffer function, we create
# a 50 mile buffer around each centroid
# https://docs.carto.com/spatial-extension-bq/sql-reference/transformations/
bqcarto.transformations.st_buffer(
st_centroid(state_geom),
50, "miles") as geom
from
`bigquery-public-data.geo_us_boundaries.states`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment