block by Fil e704f9de3a739058d55456330c838818

Proj4/WKT + D3 + projection interpolation [UNLISTED]

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

This solves Andrew’s issue with the graticule by using a fixed number of reference points on each graticule line.

I tried Peter’s interpolate-path but it has some hiccups in this situation (see Proj4/WKT + D3 + d3-interpolate-path).

Also tried Noah’s flubber, but again, problems – it yields a closed path instead of what we want, ie a line (see Proj4/WKT + D3 + flubber).

forked from Fil‘s block: Proj4/WKT + D3 [UNLISTED]

index.html

get-data.sh