-
-
Save clayzermk1/4121134 to your computer and use it in GitHub Desktop.
Mercator Projection
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> | |
<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> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment