There is, I think, a bug in mbostock's block: Fit Extent. The rotation should be [96,0] (shown in red), not [96,-39] (shown in blue). (In my understanding lat_0=39 defines the center not the rotate.)
Last active
July 15, 2018 08:57
-
-
Save Fil/4f2ffab5597cb0ba6ed3890e1486261b to your computer and use it in GitHub Desktop.
ESRI:102004 [UNLISTED]
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
license: gpl-3.0 | |
height: 720 | |
border: no |
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
<!DOCTYPE html> | |
<meta charset="utf-8"> | |
<svg width="960" height="720"></svg> | |
<script src="https://d3js.org/d3.v4.min.js"></script> | |
<script src="https://d3js.org/topojson.v1.min.js"></script> | |
<script> | |
var svg = d3.select("svg"), | |
width = +svg.attr("width"), | |
height = +svg.attr("height"); | |
d3.json("https://gist.githubusercontent.com/mbostock/4090846/raw/d534aba169207548a8a3d670c9c2cc719ff05c47/us.json", function(error, us) { | |
if (error) throw error; | |
var conus = topojson.feature(us, { | |
type: "GeometryCollection", | |
geometries: us.objects.states.geometries.filter(function(d) { | |
return d.id !== 2 // AK | |
&& d.id !== 15 // HI | |
&& d.id < 60; // outlying areas | |
}) | |
}); | |
// ESRI:102004 | |
// according to original block | |
var projection = d3.geoConicConformal() | |
.parallels([33, 45]) | |
.rotate([96, -39]) | |
.fitWidth(width, conus); | |
var path = d3.geoPath() | |
.projection(projection); | |
svg.append("path") | |
.datum(conus) | |
.attr("d", path) | |
.attr('fill', 'none') | |
.attr('stroke', 'blue'); | |
// but more probably: | |
projection.rotate([96, 0]) | |
.fitWidth(width, conus); | |
svg.append("path") | |
.datum(conus) | |
.attr("d", path) | |
.attr('fill', 'rgba(230,80,80,0.1)') | |
.attr('stroke', 'rgb(230,80,80)'); | |
}); | |
</script> |
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
�PNG | |