Skip to content

Instantly share code, notes, and snippets.

@mbforr
Last active January 8, 2023 10:40
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save mbforr/ba8f198eccdf773154817d913e24793c to your computer and use it in GitHub Desktop.
Save mbforr/ba8f198eccdf773154817d913e24793c to your computer and use it in GitHub Desktop.
select
state_name,
st_x(st_centroid(state_geom)) as lng,
st_y(st_centroid(state_geom)) as lat
# we can use two functions together
# st_centroid returns a geography
# which we can pass to st_x and st_y which return the lat/longs of the point
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