Skip to content

Instantly share code, notes, and snippets.

@toja
Last active March 8, 2018 23:00
Show Gist options
  • Save toja/38c47f0da49c589d0cd9972c73975e5b to your computer and use it in GitHub Desktop.
Save toja/38c47f0da49c589d0cd9972c73975e5b to your computer and use it in GitHub Desktop.
Europe - LAEA vs LCC
license: gpl-3.0
height: 500
border: no
Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

Europe in two projections:

Lambert Equal Area (green) - statistical analysis and display
Lambert Conformal Conic (red) - conformal pan-European mapping at scales smaller or equal to 1:500,000

Source: Map Projections for Europe (pdf)

<!DOCTYPE html>
<meta charset="utf-8">
<script src="//d3js.org/d3.v4.min.js"></script>
<script src="//d3js.org/topojson.v2.min.js"></script>
<style>
.lcc {
fill: none;
stroke: red;
opacity: 0.5;
}
.laea {
fill: none;
stroke: green;
opacity: 0.5;
}
</style>
<body>
<script>
var width = 960,
height = 500;
var projLcc = d3.geoConicConformal()
.rotate([-10.0, 0.0])
.center([0.0, 52.0])
.parallels([35.0, 65.0])
.scale(600)
.precision(.1);
var projLaea = d3.geoAzimuthalEqualArea()
.rotate([-10.0, -52.0])
.scale(600)
.precision(.1);
var pathLcc = d3.geoPath()
.projection (projLcc);
var pathLaea = d3.geoPath()
.projection (projLaea);
var graticule = d3.geoGraticule();
var svg = d3.select("body").append("svg")
.attr("width", width)
.attr("height", height);
var featuresLcc = svg.append("g")
.attr("class", "lcc");
var featuresLaea = svg.append("g")
.attr("class", "laea");
d3.json("110m.json", function (error, europe) {
if (error) throw error;
var countries = topojson.feature(europe, europe.objects.countries).features;
featuresLcc.append("path")
.datum(graticule)
.attr("d", pathLcc);
featuresLcc.selectAll("countries")
.data(countries)
.enter().append("path")
.attr("d", pathLcc);
featuresLaea.append("path")
.datum(graticule)
.attr("d", pathLaea);
featuresLaea.selectAll("countries")
.data(countries)
.enter().append("path")
.attr("d", pathLaea);
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment