public
Last active — forked from mbostock/index.html

Mercator Projection

  • Download Gist
index.html
HTML
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
<!DOCTYPE html>
<meta charset="utf-8">
<title>Mercator Projection</title>
<style>
 
path {
fill: #ccc;
stroke: #fff;
}
 
</style>
<svg width="960" height="500"></svg>
<script src="http://d3js.org/d3.v2.js?2.9.1"></script>
<script>
 
d3.json("readme.json", function(collection) {
d3.select("svg").selectAll("path")
.data(collection.features)
.enter().append("path")
.attr("d", d3.geo.path().projection(d3.geo.mercator()))
.style("fill", function(d) { return '#'+Math.floor(d.properties.name.charCodeAt(0)/100*4620980).toString(16); });
});
 
</script>
readme.json
JSON
Octocat spinner 128
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.