Skip to content

Instantly share code, notes, and snippets.

@samselikoff
Created March 4, 2014 18: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 samselikoff/9353154 to your computer and use it in GitHub Desktop.
Save samselikoff/9353154 to your computer and use it in GitHub Desktop.
cambridge with towns
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 with towns","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/fJi47K1.gif","inline-console":false}
var svg = d3.select('svg'),
width = svg[0][0].clientWidth,
height = svg[0][0].clientHeight,
scale = 265610,
translate = [90000, 59400],
lat = 42.3783903,
long = -71.1129097,
//scale = 100
center = [tributary.sw/2, tributary.sh/2]
//translate = center,
pin = "M256,50c-72.072,0-130.5,58.427-130.5,130.5c0,72.073,57.114,155.833,130.5,281.5c73.388-125.666,130.5-209.427,130.5-281.5C386.5,108.427,328.074,50,256,50z M256,224.133c-25.848,0-46.801-20.953-46.801-46.8s20.953-46.8,46.801-46.8s46.801,20.953,46.801,46.8S281.848,224.133,256,224.133z"
;
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)
.style('fill', 'none')
.style('stroke', '#666');
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