Skip to content

Instantly share code, notes, and snippets.

@fabianthoma
Created June 16, 2013 11:33
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 fabianthoma/5791785 to your computer and use it in GitHub Desktop.
Save fabianthoma/5791785 to your computer and use it in GitHub Desktop.
worldtest
{"description":"worldtest","endpoint":"","display":"svg","public":true,"require":[{"name":"topojson","url":"http://d3js.org/topojson.v1.min.js"}],"fileconfigs":{"inlet.js":{"default":true,"vim":false,"emacs":false,"fontSize":12},"_.md":{"default":true,"vim":false,"emacs":false,"fontSize":12},"config.json":{"default":true,"vim":false,"emacs":false,"fontSize":12},"world.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}
var svg = d3.select("svg");
var width = tributary.sw;
var height = tributary.sh;
var center = {
x: width/2,
y: height/2
}
var world = tributary.world;
var countries = topojson.object(world, world.objects.land);
var lonlat = [-41, -13];
var projection = d3.geo.orthographic()
//var projection = d3.geo.albers()
.scale(200)
.rotate([3,0, 0])
.center(lonlat)
.translate([width/2, height/2])
.clipAngle(90);
var xy = projection(lonlat);
//console.log(xy);
var graticule = d3.geo.graticule()
var path = d3.geo.path()
.projection(projection);
svg.append("path")
.datum(graticule)
.attr("class", "graticule")
.attr("d", path);
svg.append("path")
.attr("transform", "translate(" + [xy[0] - center.x, xy[1] - center.y ] + ")")
.attr("d", path(countries))
.classed("land", true);
svg.append("circle")
.attr({
cx: xy[0],
cy: xy[1],
r: 10
})
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