-
-
Save 1Marc/3960072 to your computer and use it in GitHub Desktop.
just another inlet to tributary
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{"endpoint":"","display":"svg","public":true,"require":[],"tab":"edit","display_percent":0.7,"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,"editor_editor":{"coffee":false,"vim":false,"emacs":false,"width":567,"height":618,"hide":false},"editor_json0":{"vim":false,"emacs":false,"width":740,"height":194,"hide":true},"editor_json1":{"vim":false,"emacs":false,"width":713,"height":223,"hide":true}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | |
}) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment