All examples By author By category About

Fil

Proj4/WKT + D3 + flubber [UNLISTED]

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