Skip to content

Instantly share code, notes, and snippets.

@wboykinm
Created February 26, 2014 19:09
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 wboykinm/9236270 to your computer and use it in GitHub Desktop.
Save wboykinm/9236270 to your computer and use it in GitHub Desktop.
Cartodb call to get count and density of points in each census block polygon
SELECT dane_county_blocks_stats.the_geom_webmercator as the_geom_webmercator, count(i.cartodb_id) as points_count, count(i.cartodb_id)/ST_Area(dane_county_blocks_stats.the_geom_webmercator)
as points_density, 1 as cartodb_id FROM dane_county_blocks_stats, (select * from dane_cty_hhs) i where ST_Intersects(i.the_geom_webmercator, dane_county_blocks_stats.the_geom_webmercator) GROUP BY dane_county_blocks_stats.the_geom_webmercator
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment