The world in cylindrical stereographic projection with parallel at 35° results in a nice map in (nearly) DIN format.
Last active
September 19, 2017 20:52
-
-
Save toja/ab5275d5c5bb3fc39ecf2f2ca1fc2c3f to your computer and use it in GitHub Desktop.
World - DIN Format
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: 500 | |
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"> | |
<style> | |
.stroke { | |
fill: none; | |
stroke: #ccc; | |
stroke-width: .5px; | |
} | |
.fill { | |
fill: #f2f4f6; | |
} | |
.graticule { | |
fill: none; | |
stroke: #ccc; | |
stroke-width: .5px; | |
stroke-opacity: .4; | |
} | |
.land { | |
fill: #e4e2e0; | |
} | |
.boundary { | |
fill: none; | |
stroke: #c6c4c2; | |
stroke-width: 0.5px; | |
} | |
</style> | |
<body> | |
<script src="//d3js.org/d3.v4.min.js"></script> | |
<script src="//d3js.org/d3-geo-projection.v1.min.js"></script> | |
<script src="//d3js.org/topojson.v2.min.js"></script> | |
<script> | |
var width = 960, | |
height = 500; | |
var proj = d3.geoCylindricalStereographic() | |
.parallel(35) // DIN | |
.precision(.1); | |
var path = d3.geoPath() | |
.projection(proj); | |
var graticule = d3.geoGraticule(); | |
var svg = d3.select("body").append("svg") | |
.attr("width", width) | |
.attr("height", height); | |
var defs = svg.append("defs"); | |
defs.append("path") | |
.datum({type: "Sphere"}) | |
.attr("id", "sphere") | |
.attr("d", path); | |
svg.append("use") | |
.attr("class", "stroke") | |
.attr("xlink:href", "#sphere"); | |
svg.append("use") | |
.attr("class", "fill") | |
.attr("xlink:href", "#sphere"); | |
var features = svg.append("g"); | |
features.append("path") | |
.datum(graticule) | |
.attr("class", "graticule") | |
.attr("d", path); | |
d3.json("110m.json", function(error, world) { | |
if (error) throw error; | |
features.append("path") | |
.datum(topojson.feature(world, world.objects.countries)) | |
.attr("class", "land") | |
.attr("d", path); | |
features.append("path") | |
.datum(topojson.mesh(world, world.objects.countries, function(a, b) { return a !== b; })) | |
.attr("class", "boundary") | |
.attr("d", path); | |
}); | |
d3.select(self.frameElement).style("height", height + "px"); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment