Skip to content

Instantly share code, notes, and snippets.

@enjalot
Created February 23, 2013 21:51
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/5021511 to your computer and use it in GitHub Desktop.
Save enjalot/5021511 to your computer and use it in GitHub Desktop.
Geneva bus routes
{"description":"Geneva bus routes","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},"world110.json":{"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},"style.css":{"default":true,"vim":false,"emacs":false,"fontSize":12},"routes.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/Uhuy72M.png"}
var svg = d3.select("svg");
var routes = tributary.routes;
var world = tributary.world110;
var countries = topojson.object(world, world.objects.land);
var width = tributary.sw;
var height = tributary.sh;
var center = {
x: width/2,
y: height/2
}
var colorScale = d3.scale.category20();
var lonlat = [6.083, 46.26];
var projection = d3.geo.mercator()
.center(lonlat)
.scale(480904)
.translate([width/2, height/2])
var xy = projection(lonlat);
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("d", path(countries))
.classed("land", true);
/*
svg.append("circle")
.attr({
cx: xy[0],
cy: xy[1],
r: 10
})*/
svg.selectAll("path.routes")
.data(routes.features)
.enter()
.append("path")
.attr("d", path)
.style("stroke", function(d,i) { return colorScale(i)})
.style("fill", "none")
.style("stroke-width", 3)
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.
View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment