Fun with PostGIS, or, how Kanye sees the world.
Created
February 25, 2014 04:45
-
-
Save jczaplew/9202878 to your computer and use it in GitHub Desktop.
Fun with PostGIS
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> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0"> | |
<style> | |
.latitude { | |
stroke-width:1.5px; | |
stroke:#777; | |
fill:none; | |
} | |
</style> | |
</head> | |
<body> | |
<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.v1.min.js"></script> | |
<script type="text/javascript"> | |
var width = 960, | |
height = 500; | |
var projection = d3.geo.hammer() | |
.precision(0.3) | |
.scale(170); | |
var path = d3.geo.path() | |
.projection(projection); | |
var svg = d3.select("body").append("svg") | |
.attr("width", width) | |
.attr("height", height) | |
.append("g"); | |
d3.json("data.topojson", function(error, lines) { | |
svg.selectAll(".latitude") | |
.data(topojson.feature(lines, lines.objects.data).features) | |
.enter().append("path") | |
.attr("class", "latitude") | |
.attr("d", path); | |
}); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment