Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
A D3 map using topojson
<meta charset="utf-8">
<title>A D3 map using topojson</title>
<script src=""></script>
<script src=""></script>
<script src=""></script>
<link href="" rel="stylesheet" type="text/css">
body {
padding: 0;
margin: 0;
background: whitesmoke;
h1 {
position: absolute;
left: 20px;
top: 10px;
font-family: "Proxima Nova", Montserrat, sans-serif;
font-size: 2em;
font-weight: 100;
color: #005DAA; /* offical UK Kentucky blue */
.county {
stroke: #fff;
<h1>Kentucky Counties</h1>
var width = 900,
height = 600;
var svg = "body" )
.append( "svg" )
.attr( "width", width )
.attr( "height", height );
var projection = d3.geo.albers()
.center([0, 37.8])
.translate([width / 2, height / 2]);
var geoPath = d3.geo.path()
.defer(d3.json, "ky-counties.json")
function ready(error, counties){
.data( topojson.feature(counties, counties.objects.counties).features)
.attr( "d", geoPath )
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment