Use Proj4js to convert proj4 or WKT projection definition strings into D3 projections.
// Create Proj4js projection function
var proj4Projection = proj4(wkt); // WGS84 to projection defined in `wkt`
// Use this to create a D3 projection
var project = function(lambda, phi) {
return proj4Projection
.forward([lambda, phi].map(radiansToDegrees));
};
project.invert = function(x, y) {
return proj4Projection
.inverse([x, y]).map(degreesToRadians);
};
var projection = d3.geoProjection(project);
Geographic data from Eurostat's GISCO program. The example projections came from Spatial Reference.
forked from armollica's block: Proj4/WKT + D3
There are three ways to transition the shapes from one projection to the other:
-- Mike Bostock's and Jason Davies' projection transitions is probably the correct way to do it
-- Noah Veltman's flubber interpolates shapes beautifully, but not lines (graticules) yet
-- Peter Beshai's d3-interpolate-path works well with those graticules since version 2
https://d3js.org/d3.v4.min.js
https://d3js.org/topojson.v1.min.js
https://unpkg.com/proj4
https://unpkg.com/d3-interpolate-path