Skip to content

Instantly share code, notes, and snippets.

@jczaplew
Created February 25, 2014 04:45
Show Gist options
  • Save jczaplew/9202878 to your computer and use it in GitHub Desktop.
Save jczaplew/9202878 to your computer and use it in GitHub Desktop.
Fun with PostGIS

Fun with PostGIS, or, how Kanye sees the world.

Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
<!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