Skip to content

Instantly share code, notes, and snippets.

@samselikoff
Created February 27, 2014 17:58
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 samselikoff/9255346 to your computer and use it in GitHub Desktop.
Save samselikoff/9255346 to your computer and use it in GitHub Desktop.
cambridge
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.
{"description":"cambridge","endpoint":"","display":"svg","public":true,"require":[{"name":"topojson","url":"http://d3js.org/topojson.v0.min.js"}],"fileconfigs":{"inlet.js":{"default":true,"vim":false,"emacs":false,"fontSize":12},"data.json":{"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},"uk.json":{"default":true,"vim":false,"emacs":false,"fontSize":12},"boston.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":"pingpong","bv":false,"nclones":15,"clone_opacity":0.4,"duration":3000,"ease":"linear","dt":0.01,"thumbnail":"http://i.imgur.com/p99ovwR.gif","inline-console":false}
var svg = d3.select('svg'),
width = svg[0][0].clientWidth,
height = svg[0][0].clientHeight,
scale = 246402,
translate = [90000, 59400],
lat = 42.3783903,
long = -71.1129097,
//scale = 100
center = [tributary.sw/2, tributary.sh/2]
//translate = center,
;
console.log(tributary.boston);
var proj = d3.geo.mercator()
.scale(scale)
.translate(center),
//.translate(translate),
path = d3.geo.path().projection(proj),
//data = tributary.world
data = tributary.boston
;
var xy = proj([long, lat]);
svg.append('g')
.attr("transform", "translate(" + [center[0]-xy[0], center[1]-xy[1]] + ")")
.append("path")
.datum(data)
.attr("d", path);
console.log("translate(" + [center[0]-xy[0], center[1]-xy[1]] + ")");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment