Skip to content

Instantly share code, notes, and snippets.

@enjalot
Created February 3, 2013 05:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save enjalot/4700685 to your computer and use it in GitHub Desktop.
Save enjalot/4700685 to your computer and use it in GitHub Desktop.
satellite
{"description":"satellite","endpoint":"","display":"svg","public":true,"require":[{"name":"projection","url":"http://d3js.org/d3.geo.projection.v0.min.js"},{"name":"topojson","url":"http://d3js.org/topojson.v0.min.js"}],"fileconfigs":{"inlet.js":{"default":true,"vim":false,"emacs":false,"fontSize":12},"world110.json":{"default":true,"vim":false,"emacs":false,"fontSize":12},"style.css":{"default":true,"vim":false,"emacs":false,"fontSize":12},"config.json":{"default":true,"vim":false,"emacs":false,"fontSize":12},"_.md":{"default":true,"vim":false,"emacs":false,"fontSize":12},"us.json":{"default":true,"vim":false,"emacs":false,"fontSize":12}},"play":false,"loop":false,"restart":false,"autoinit":true,"pause":true,"loop_type":"period","bv":false,"nclones":15,"clone_opacity":0.4,"duration":3000,"ease":"linear","dt":0.01}
var svg = d3.select("svg");
var width = tributary.sw;
var height = tributary.sh;
var world = tributary.world110;
var countries = topojson.object(world, world.objects.countries)
var us = tributary.us;
var states = topojson.object(us, us.objects.land);
var globe = {type: "Sphere"};
var projection = d3.geo.satellite()
.distance(1 + 0.04981)
.scale(2701)
.rotate([413, 22.5, 225])
.tilt(-4)
.clipAngle(17);
//var projection = d3.geo.mercator()
//.scale(650)
// The reference 74ºW, 41ºN is at 181px, 710px.
var offset = projection.translate([-181, -710])([-74, 41]);
projection.translate([-offset[0], -offset[1]]);
var graticule = d3.geo.graticule()
//.extent([[-93, 27], [-47 + 1e-6, 57 + 1e-6]])
.step([5, 5]);
var path = d3.geo.path()
.projection(projection);
svg.append("path")
.datum(graticule)
.attr("class", "graticule")
.attr("d", path);
svg.append("path")
.datum(countries)
.attr("class", "land")
.attr("d", path);
.graticule {
fill: none;
stroke: red;
}
.land {
fill: #787985;
fill-opacity: .8;
stroke: #000;
}
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.
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment