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')
.
license: mit | |
border: none |
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="https://d3js.org/d3.v3.min.js" charset="utf-8"></script> | |
<script src="https://d3js.org/topojson.v1.min.js"></script> | |
<script src="https://unpkg.com/rbush@1.4.3/rbush.js"></script> | |
<script src="https://unpkg.com/spamjs@1.1.0/spam.min.js"></script> | |
<script src="https://cdn.rawgit.com/gka/d3-geo-state-plane/master/state-plane.js"></script> | |
<script type='text/javascript'> | |
d3.json("/mbostock/raw/4090846/us.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> |