Created
April 26, 2013 09:57
-
-
Save tomstove/5466190 to your computer and use it in GitHub Desktop.
Roads of NYC
This file contains hidden or 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> | |
<head> | |
<style> | |
.roads { | |
fill: none; | |
stroke: orange; | |
stroke-width: 0.3px; | |
} | |
</style> | |
<script src="http://d3js.org/d3.v3.min.js"></script> | |
<script src="http://d3js.org/d3.geo.projection.v0.min.js"></script> | |
<script src="http://d3js.org/topojson.v0.min.js"></script> | |
</head> | |
<body> | |
<script> | |
var width = 960, | |
height = 500; | |
var projection = d3.geo.mercator() | |
.translate([400,-250]) | |
.center([-73.963394165, 40.7811913532]) | |
.scale(200000); | |
var path = d3.geo.path() | |
.projection(projection); | |
var svg = d3.select("body").append("svg") | |
.attr("width", width) | |
.attr("height", height); | |
var roads = svg.append("g") | |
.attr("transform", "rotate(60)") | |
d3.json('nyc_roads.json', function(err, data) { | |
roads.selectAll("path") | |
.data(data.features) | |
.enter().append("path") | |
.attr("class", "roads") | |
.attr("d", path); | |
}); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment