Skip to content

Instantly share code, notes, and snippets.

@enjalot
Forked from anonymous/_.md
Created September 26, 2012 17:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save enjalot/3789441 to your computer and use it in GitHub Desktop.
Save enjalot/3789441 to your computer and use it in GitHub Desktop.
just another inlet to tributary
{"editor_editor":{"coffee":false,"vim":false,"emacs":false,"width":567,"height":618,"hide":false},"endpoint":"tributary","public":true,"editor_json0":{"vim":false,"emacs":false,"width":740,"height":194,"hide":true},"editor_json1":{"vim":false,"emacs":false,"width":713,"height":223,"hide":true}}
var countries = tributary.worldcountries;
var svg = d3.select("svg");
var cw = 600;
var ch = 429;
var projection = d3.geo.azimuthal()
.scale(287)
.translate([361, 421])
.origin([-101, 30])
//then we need a path function
var geopath = d3.geo.path()
.projection(projection);
var greatCircle = d3.geo.greatCircle()
.origin(projection.origin());
//create a path for each country
svg.selectAll("path")
.data(countries.features)
.enter()
.append("path")
.attr({
d: function(d) { return geopath(greatCircle.clip(d)) },
id: function(d) { return d.properties.name; },
fill:"#03A009",
stroke:"#FFFFFF",
})
svg.select("#Antarctica").remove();
navigator.geolocation.getCurrentPosition(function(d) {
console.log(d);
svg.append("circle")
.attr({
r: 8,
transform: function() {
var coord = projection([d.coords.longitude, d.coords.latitude]);
return "translate(" + coord + ")";
},
fill: "#239ADD",
stroke: "#000FFF"
})
})
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