USA Urban population. Data from census.gov.
Last active
August 29, 2015 14:26
-
-
Save bricedev/32830794d6b1488eb256 to your computer and use it in GitHub Desktop.
Urban Population
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<meta charset="utf-8"> | |
<body> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.5/d3.min.js"></script> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/topojson/1.6.19/topojson.min.js"></script> | |
<script> | |
var width = 960, | |
height = 600; | |
var projection = d3.geo.albersUsa() | |
.scale(1100) | |
.translate([width / 2, height / 2]); | |
var path = d3.geo.path() | |
.projection(projection); | |
var svg = d3.select("body").append("svg") | |
.attr("width", width) | |
.attr("height", height); | |
d3.json("us.json", function(error, us) { | |
if (error) throw error; | |
svg.append("g") | |
.selectAll("path") | |
.data(topojson.feature(us, us.objects.usa).features) | |
.enter().append("path") | |
.attr("d", path) | |
.style("stroke","#000"); | |
svg.append("g") | |
.selectAll("path") | |
.data(topojson.feature(us, us.objects.urban).features) | |
.enter().append("path") | |
.attr("d", path) | |
.style("fill","#fff"); | |
}); | |
d3.select(self.frameElement).style("height", height + "px"); | |
</script> |
ogr2ogr
-f GeoJSON
usa.json
cb_2014_us_nation_5m.shp
ogr2ogr
-f GeoJSON
urban.json
cb_2014_us_ua10_500k.shp
topojson
-o us.json
--
usa.json
urban.json
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment