Skip to content

Instantly share code, notes, and snippets.

@fasiha
Created July 24, 2013 16:49
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 fasiha/6072311 to your computer and use it in GitHub Desktop.
Save fasiha/6072311 to your computer and use it in GitHub Desktop.
Europe from the East, Harrison
{"description":"Europe from the East, Harrison","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}},"fullscreen":false,"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,"thumbnail":"http://i.imgur.com/hZFispE.png"}
//http://www.nytimes.com/interactive/2013/03/01/world/americas/border-graphic.html
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 d = 1.82;
var projection = d3.geo.satellite()
.distance(d)
.scale(668)
.rotate([-58.3, -56.9, -82])//-long,-lat,rot clockwise from north
.center([0, 0])
.translate([390,630])
.tilt(-12)
.clipAngle(Math.acos(1 / d) * 180 / Math.PI - 1e-6);
//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]]);
//alert(([0.0,0.0]))
var graticule = d3.geo.graticule()
.extent([[-40, 40], [40 + 1e-6, 70 + 1e-6]])//[long,lat]
.step([10, 10]);
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment