Azimuthal Equidistant projection done with Canvas.
Using the type "Sphere" to get the outline instead of graticule.outline().
| license: mit | |
| border: none | |
| height: 1000 |
Azimuthal Equidistant projection done with Canvas.
Using the type "Sphere" to get the outline instead of graticule.outline().
| <!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/d3-geo-projection@0.2.16/d3.geo.projection.min.js"></script> | |
| <script src="https://unpkg.com/spamjs@1.1.0/spam.min.js"></script> | |
| <script type='text/javascript'> | |
| var graticule = d3.geo.graticule(); | |
| d3.json("https://unpkg.com/world-atlas@1.1.4/world/50m.json", function(err, d) { | |
| topojson.presimplify(d); | |
| var map = new StaticCanvasMap({ | |
| element: "body", | |
| width: 960, | |
| height: 1000, | |
| projection: d3.geo | |
| .azimuthalEquidistant() | |
| .scale(150) | |
| .translate([960 / 2, 1000 / 2]) | |
| .clipAngle(180 - 4e-3) | |
| .precision(0.1), | |
| data: [ | |
| { | |
| features: topojson.feature(d, d.objects["countries"]), | |
| static: { | |
| prepaint: function(parameters) { | |
| parameters.context.beginPath(); | |
| parameters.path(graticule()); | |
| parameters.context.lineWidth = 0.5; | |
| parameters.context.strokeStyle = "rgb(170,170,170)"; | |
| parameters.context.stroke(); | |
| parameters.context.beginPath(); | |
| parameters.path({ type: "Sphere" }); | |
| parameters.context.lineWidth = 1.5; | |
| parameters.context.strokeStyle = "rgb(30,30,30)"; | |
| parameters.context.stroke(); | |
| }, | |
| paintfeature: function(parameters, d) { | |
| parameters.context.lineWidth = 0.5; | |
| parameters.context.strokeStyle = "rgb(255,255,255)"; | |
| parameters.context.stroke(); | |
| parameters.context.fillStyle = "#111"; | |
| parameters.context.fill(); | |
| } | |
| } | |
| } | |
| ] | |
| }); | |
| map.init(); | |
| }); | |
| </script> |