block by fil fbbccd40266014ebe0364da8975a7992

Proj4/WKT + D3 + d3-interpolate-path

Full Screen

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

index.html

get-data.sh