How to use the d3-geo.geoProjectionMutator function in d3-geo

To help you get started, we’ve selected a few d3-geo examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github d3 / d3-geo-projection / src / wagner.js View on Github external
export default function wagner() {
  // default values generate wagner8
  var poleline = 65 * radians,
      parallels = 60 * radians,
      inflation = 20,
      ratio = 200,
      mutate = projectionMutator(wagnerRaw),
      projection = mutate(poleline, parallels, inflation, ratio);

  projection.poleline = function(_) {
    return arguments.length ? mutate(poleline = +_ * radians, parallels, inflation, ratio) : poleline * degrees;
  };

  projection.parallels = function(_) {
    return arguments.length ? mutate(poleline, parallels = +_ * radians, inflation, ratio) : parallels * degrees;
  };
  projection.inflation = function(_) {
    return arguments.length ? mutate(poleline, parallels, inflation = +_, ratio) : inflation;
  };
  projection.ratio = function(_) {
    return arguments.length ? mutate(poleline, parallels, inflation, ratio = +_) : ratio;
  };
github d3 / d3-geo-projection / src / gingery.js View on Github external
export default function() {
  var n = 6,
      rho = 30 * radians,
      cRho = cos(rho),
      sRho = sin(rho),
      m = projectionMutator(gingeryRaw),
      p = m(rho, n),
      stream_ = p.stream,
      epsilon = 1e-2,
      cr = -cos(epsilon * radians),
      sr = sin(epsilon * radians);

  p.radius = function(_) {
    if (!arguments.length) return rho * degrees;
    cRho = cos(rho = _ * radians);
    sRho = sin(rho);
    return m(rho, n);
  };

  p.lobes = function(_) {
    if (!arguments.length) return n;
    return m(rho, n = +_);
github d3 / d3-geo-projection / src / berghaus.js View on Github external
export default function() {
  var lobes = 5,
      m = projectionMutator(berghausRaw),
      p = m(lobes),
      projectionStream = p.stream,
      epsilon = 1e-2,
      cr = -cos(epsilon * radians),
      sr = sin(epsilon * radians);

  p.lobes = function(_) {
    return arguments.length ? m(lobes = +_) : lobes;
  };

  p.stream = function(stream) {
    var rotate = p.rotate(),
        rotateStream = projectionStream(stream),
        sphereStream = (p.rotate([0, 0]), projectionStream(stream));
    p.rotate(rotate);
    rotateStream.sphere = function() {
github d3 / d3-geo-projection / src / parallel2.js View on Github external
export default function(projectAt) {
  var phi0 = 0,
      phi1 = pi / 3,
      m = geoProjectionMutator(projectAt),
      p = m(phi0, phi1);

  p.parallels = function(_) {
    if (!arguments.length) return [phi0 * degrees, phi1 * degrees];
    return m(phi0 = _[0] * radians, phi1 = _[1] * radians);
  };

  return p;
}
github d3 / d3-geo-projection / src / lagrange.js View on Github external
export default function() {
  var n = 0.5,
      m = projectionMutator(lagrangeRaw),
      p = m(n);

  p.spacing = function(_) {
    return arguments.length ? m(n = +_) : n;
  };

  return p
      .scale(124.75);
}
github d3 / d3-geo-projection / src / hill.js View on Github external
export default function() {
  var K = 1,
      m = projectionMutator(hillRaw),
      p = m(K);

  p.ratio = function(_) {
    return arguments.length ? m(K = +_) : K;
  };

  return p
      .scale(167.774)
      .center([0, 18.67]);
}
github d3 / d3-geo-polygon / src / imago.js View on Github external
export default function() {
  var k = 0.59,
    shift = 1.16,
    m = projectionMutator(imagoWideRaw),
    p = m(k, shift);

  p.shift = function(_) {
    return arguments.length ? clipped(m(k, (shift = +_))) : shift;
  };
  p.k = function(_) {
    return arguments.length ? clipped(m((k = +_), shift)) : k;
  };

  function clipped(p) {
    const N = 100 + 2 * epsilon,
      border = [],
      e = 3e-3;

    const scale = p.scale(),
      center = p.center(),
github d3 / d3-geo-polygon / src / imago.js View on Github external
export function imagoBlock() {
  var k = 0.68,
    m = projectionMutator(imagoRaw),
    p = m(k);

  p.k = function(_) {
    return arguments.length ? m((k = +_)) : k;
  };

  var a = -atan(1 / sqrt(2)) * degrees,
    border = [
      [-180 + epsilon, a + epsilon],
      [0, 90],
      [180 - epsilon, a + epsilon],
      [180 - epsilon, a - epsilon],
      [-180 + epsilon, a - epsilon],
      [-180 + epsilon, a + epsilon]
    ];
github d3 / d3-geo-projection / src / healpix.js View on Github external
export default function() {
  var H = 4,
      m = projectionMutator(healpixRaw),
      p = m(H),
      stream_ = p.stream;

  p.lobes = function(_) {
    return arguments.length ? m(H = +_) : H;
  };

  p.stream = function(stream) {
    var rotate = p.rotate(),
        rotateStream = stream_(stream),
        sphereStream = (p.rotate([0, 0]), stream_(stream));
    p.rotate(rotate);
    rotateStream.sphere = function() { geoStream(sphere(180 / H), sphereStream); };
    return rotateStream;
  };
github d3 / d3-geo-projection / src / parallel1.js View on Github external
export default function(projectAt) {
  var phi0 = 0,
      m = projectionMutator(projectAt),
      p = m(phi0);

  p.parallel = function(_) {
    return arguments.length ? m(phi0 = _ * radians) : phi0 * degrees;
  };

  return p;
}