A quick test of d3.geo.statePlanes using Spam.
This projection centers the map on a given state through its code. In this case New York with d3.geo.statePlane('NY').
A quick test of d3.geo.statePlanes using Spam.
This projection centers the map on a given state through its code. In this case New York with d3.geo.statePlane('NY').
| <!DOCTYPE html> | |
| <meta charset="utf-8" /> | |
| <body> | |
| <script src="//d3js.org/d3.v3.min.js" charset="utf-8"></script> | |
| <script src="//d3js.org/topojson.v1.min.js"></script> | |
| <script src="//cdn.rawgit.com/mourner/rbush/master/rbush.js"></script> | |
| <script src="//cdn.rawgit.com/gka/d3-geo-state-plane/master/state-plane.js"></script> | |
| <script src="//cdn.rawgit.com/newsappsio/spam/master/spam.min.js"></script> | |
| <script type='text/javascript'> | |
| d3.json("us-states.json", function(error, d) { | |
| topojson.presimplify(d) | |
| var map = new StaticCanvasMap({ | |
| element: "body", | |
| width: 960, | |
| height: 500, | |
| projection: d3.geo.statePlane('NY'), | |
| data: [{ | |
| features: topojson.feature(d, d.objects["states"]), | |
| static: { | |
| paintfeature: function(parameters, d) { | |
| parameters.context.lineWidth = 1 | |
| parameters.context.strokeStyle = "rgb(255,255,255)" | |
| parameters.context.fillStyle = "rgb(30, 30, 30)" | |
| parameters.context.stroke() | |
| parameters.context.fill() | |
| } | |
| } | |
| } | |
| ] | |
| }) | |
| map.init() | |
| }) | |
| </script> |