Skip to content

Instantly share code, notes, and snippets.

@tel
Created October 18, 2012 23:26
Show Gist options
  • Save tel/3915375 to your computer and use it in GitHub Desktop.
Save tel/3915375 to your computer and use it in GitHub Desktop.
select
county,
population,
(population / ST_Area(wkb_geometry)) * 1000000 as popsqkm,
wkb_geometry,
replace(county, ' County', '') || E'\n' ||
'pop. ' || population || E'\n' ||
round((population / ST_Area(wkb_geometry))::numeric * 1000000, 1) || E' / km²\n'
as label
into merged
from population, tl_2010_17_county10
where id = geoid10;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment