Oblique Hammer projection, created using a combination of d3.geo.hammer and d3.geo.clip from the geo.projection D3 plugin.
Coordinates are rotated 45° counterclockwise.
Oblique Hammer projection, created using a combination of d3.geo.hammer and d3.geo.clip from the geo.projection D3 plugin.
Coordinates are rotated 45° counterclockwise.
| <!DOCTYPE html> | |
| <meta charset="utf-8"> | |
| <style> | |
| .background { | |
| fill: #a4bac7; | |
| } | |
| .foreground { | |
| fill: none; | |
| stroke: #333; | |
| stroke-width: 1.5px; | |
| } | |
| .graticule { | |
| fill: none; | |
| stroke: #fff; | |
| stroke-width: .5px; | |
| } | |
| .graticule:nth-child(2n) { | |
| stroke-dasharray: 2,2; | |
| } | |
| .land { | |
| fill: #d7c7ad; | |
| xstroke: #766951; | |
| } | |
| .boundary { | |
| fill: none; | |
| stroke: #a5967e; | |
| } | |
| </style> | |
| <body> | |
| <script src="http://d3js.org/d3.v3.min.js"></script> | |
| <script src="https://raw.github.com/d3/d3-plugins/master/geo/projection/projection.js"></script> | |
| <script> | |
| var width = 960, | |
| height = 500; | |
| var outlinePath = d3.geo.path() | |
| .projection(d3.geo.hammer() | |
| .translate([width / 2 - .5, height / 2 - .5])); | |
| var path = d3.geo.path() | |
| .projection(d3.geo.hammer() | |
| .rotate([0, 0, 45]) | |
| .translate([width / 2 - .5, height / 2 - .5])); | |
| var graticule = d3.geo.graticule().extent([[-180, -80], [180, 80]]).step([10, 10]), | |
| outline = d3.geo.graticule(); | |
| var svg = d3.select("body").append("svg") | |
| .attr("width", width) | |
| .attr("height", height); | |
| svg.append("path") | |
| .datum(outline.outline) | |
| .attr("class", "background") | |
| .attr("d", outlinePath); | |
| svg.selectAll(".graticule") | |
| .data(graticule.lines) | |
| .enter().append("path") | |
| .attr("class", "graticule") | |
| .attr("d", path); | |
| svg.append("path") | |
| .datum(outline.outline) | |
| .attr("class", "foreground") | |
| .attr("d", outlinePath); | |
| d3.json("readme-boundaries.json", function(err, collection) { | |
| svg.insert("g", ".graticule") | |
| .attr("class", "boundary") | |
| .selectAll("path") | |
| .data(collection.features) | |
| .enter().append("path") | |
| .attr("d", path); | |
| }); | |
| d3.json("readme-world-countries.json", function(err, collection) { | |
| svg.insert("g", ".graticule,.boundary") | |
| .attr("class", "land") | |
| .selectAll("path") | |
| .data(collection.features) | |
| .enter().append("path") | |
| .attr("d", path); | |
| }); | |
| </script> |