Skip to content

Instantly share code, notes, and snippets.

@saleiva
Forked from andrewxhill/bounding circle on cartodb
Created February 23, 2012 16:29
Show Gist options
  • Save saleiva/1893566 to your computer and use it in GitHub Desktop.
Save saleiva/1893566 to your computer and use it in GitHub Desktop.
Creates a bounding circle from the_geom_webmercator on cartodb
SELECT
ST_Buffer(
st_centroid(ST_Union(the_geom_webmercator)),
st_distance(
st_centroid(ST_Union(the_geom_webmercator)),
ST_EndPoint(ST_LongestLine(
ST_Union(the_geom_webmercator),
ST_Union(the_geom_webmercator)
))
)
) as the_geom_webmercator
FROM table_name GROUP BY some_column
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment