forked from mbostock's block: Tobler–Mercator
Created
December 10, 2017 10:16
-
-
Save anonymous/a81ada7a28b6ca14b06814ce4ec71320 to your computer and use it in GitHub Desktop.
Tobler–Mercator
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: 960 | |
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> | |
.graticule { | |
fill: none; | |
stroke: #777; | |
stroke-opacity: 0.25; | |
} | |
.land { | |
fill: #555; | |
} | |
.boundary { | |
fill: none; | |
stroke: #000; | |
stroke-width: 0.5px; | |
} | |
</style> | |
<svg width="960" height="960"></svg> | |
<script src="https://d3js.org/d3.v4.min.js"></script> | |
<script src="https://unpkg.com/topojson-client@3"></script> | |
<script> | |
var svg = d3.select("svg") | |
.style('background', '#000') | |
var width = +svg.attr("width") | |
var height = +svg.attr("height") | |
var projection = d3.geoNaturalEarth1(); | |
var path = d3.geoPath() | |
.projection(projection); | |
var graticule = d3.geoGraticule(); | |
svg.append("defs").append("path") | |
.datum(graticule.outline()) | |
.attr("id", "sphere") | |
.attr("d", path); | |
svg.append("path") | |
.datum(graticule) | |
.attr("class", "graticule") | |
.attr("d", path); | |
d3.json("https://unpkg.com/world-atlas@1/world/50m.json", function(world) { | |
svg.insert("path", ".graticule") | |
.datum(topojson.feature(world, world.objects.land)) | |
.attr("class", "land") | |
.attr("d", path); | |
svg.insert("path", ".graticule") | |
.datum(topojson.mesh(world, world.objects.countries, function(a, b) { return a !== b; })) | |
.attr("class", "boundary") | |
.attr("d", path); | |
var group = svg | |
.append('g') | |
var dot = [ | |
-75.322, | |
4.895 | |
] | |
group | |
.append('circle') | |
.datum(dot) | |
.attr('r', 5) | |
.attr('fill', 'white') | |
.attr('cx', function (d) { | |
var point = projection(d); | |
return point[0]; | |
}) | |
.attr('cy', function (d) { | |
var point = projection(d); | |
return point[1]; | |
}) | |
}); | |
</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
���� JFIF H H �� C | |
$.' ",#(7),01444'9=82<.342�� C 2!!22222222222222222222222222222222222222222222222222�� ��" |