d3.js - How does D3's projection function work for paths and points? -
my understanding of d3's projection functions same thing scale functions. map gps coordinates pixel coordinates. projection i'm using. (i don't understand variables in detail fiddled around them until map showed up)
var projection = d3.geo.albers() .center([-122.436269,37.798107]) .rotate([0, 0, 0]) .parallels([36, 38]) .scale(300000);
this draws map fine:
.attr("d", d3.geo.path().projection(projection))
when try plot points though numbers crazy.
.attr("cx",function(d) { return projection([d._lon,d._lat])[0]; }) .attr("cy",function(d) { return projection([d._lon,d._lat])[1]; });
how this?
here examples of points i'm getting through projection function:
[5175.3799972560955, 1808.5108650794136] [5158.315547249338, 1823.564395627589] [5143.958532762888, 1831.9879789081751]
on 1280x800 screen these way off. if scale them dividing 100, they'll still stack on top of each other. have 700*700 svg positioned using twitter bootstrap. not sure how taken account. assumed if map if fine, same projection should work points.
Comments
Post a Comment