Skip to content

Instantly share code, notes, and snippets.

@GitNoise
Last active August 9, 2016 16:18
Show Gist options
  • Save GitNoise/30b50f4005b09cdb85018a6da0d36a84 to your computer and use it in GitHub Desktop.
Save GitNoise/30b50f4005b09cdb85018a6da0d36a84 to your computer and use it in GitHub Desktop.
Map #2
license: gpl-3.0
Display the source blob
Display the rendered blob
Raw
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
<!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="//d3js.org/d3.v3.min.js"></script>
<script>
var projection = d3.geo.mercator();
var path = d3.geo.path()
.projection(projection);
var svg = d3.select("svg");
d3.json("https://gist.githubusercontent.com/GitNoise/a849b7cd1c15350560b93ce8752be363/raw/967b0e3d561653d8e4419d84562a9784d411bae7/output.json", function(error, collection) {
if (error) throw error;
console.log(collection.objects.alla_lan.geometries);
svg.selectAll("path")
.data(collection.objects.alla_lan.geometries.filter(function(d) {
return d.type
}))
.enter().append("path")
.attr("d", path);
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment