[ Launch: Weather stations ] 4743404 by poezn
-
-
Save poezn/4743404 to your computer and use it in GitHub Desktop.
Weather stations pseudo heatmap
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
{"description":"Weather stations pseudo heatmap","endpoint":"","display":"canvas","public":true,"require":[],"fileconfigs":{"inlet.js":{"default":true,"vim":false,"emacs":false,"fontSize":12},"stations.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}},"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} |
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 projection = d3.geo.equirectangular() | |
.scale(143) | |
var c = tb.ctx; | |
var path = d3.geo.path() | |
.projection(projection) | |
.context(c); | |
path.pointRadius(14); | |
var drawPoint = function(p) { | |
var coords = d3.geo.centroid(p); | |
var cs = projection(coords); | |
var grd = c.createRadialGradient(cs[0], cs[1], 0, cs[0], cs[1], 15); | |
console.log(p); | |
grd.addColorStop(0, 'rgba(255,0,0,.2)'); | |
grd.addColorStop(1, 'rgba(255,0,0,0)'); | |
c.fillStyle = grd; | |
c.beginPath(); | |
path(p) | |
c.closePath(); | |
c.fill(); | |
}; | |
var stations = tb['stations']; | |
console.log(stations.features[0]); | |
stations.features.forEach(drawPoint); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment