How to use the d3-geo.geoGnomonic 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 DefinitelyTyped / DefinitelyTyped / types / d3-geo / d3-geo-tests.ts View on Github external
// ----------------------------------------------------------------------
// Pre-Defined Projections
// ----------------------------------------------------------------------

// Create predefined Projection from factory =============================

const albers: d3Geo.GeoConicProjection = d3Geo.geoAlbers();
const albersUsa: d3Geo.GeoProjection = d3Geo.geoAlbersUsa();
const azimuthalEqualArea: d3Geo.GeoProjection = d3Geo.geoAzimuthalEqualArea();
const azimuthalEquidistant: d3Geo.GeoProjection = d3Geo.geoAzimuthalEquidistant();
let conicConformal: d3Geo.GeoConicProjection = d3Geo.geoConicConformal();
const conicEqualArea: d3Geo.GeoConicProjection = d3Geo.geoConicEqualArea();
const conicEquidistant: d3Geo.GeoConicProjection = d3Geo.geoConicEquidistant();
const cquirectangular: d3Geo.GeoProjection = d3Geo.geoEquirectangular();
const gnomonic: d3Geo.GeoProjection = d3Geo.geoGnomonic();
const mercator: d3Geo.GeoProjection = d3Geo.geoMercator();
const orthographic: d3Geo.GeoProjection = d3Geo.geoOrthographic();
const stereographic: d3Geo.GeoProjection = d3Geo.geoStereographic();
const transverseMercator: d3Geo.GeoProjection = d3Geo.geoTransverseMercator();

// ----------------------------------------------------------------------
// Create New Projections
// ----------------------------------------------------------------------

const geoProjection: d3Geo.GeoProjection = d3Geo.geoProjection(azimuthalEqualAreaRaw);

const mutate: () => d3Geo.GeoProjection = d3Geo.geoProjectionMutator(() => azimuthalEqualAreaRaw);
let constructedProjection: d3Geo.GeoProjection = mutate();

// Use Projection ==========================================================
github DefinitelyTyped / DefinitelyTyped / d3-geo / d3-geo-tests.ts View on Github external
// ----------------------------------------------------------------------
// Pre-Defined Projections
// ----------------------------------------------------------------------

// Create predefined Projection from factory =============================

const albers: d3Geo.GeoConicProjection = d3Geo.geoAlbers();
const albersUsa: d3Geo.GeoProjection = d3Geo.geoAlbersUsa();
const azimuthalEqualArea: d3Geo.GeoProjection = d3Geo.geoAzimuthalEqualArea();
const azimuthalEquidistant: d3Geo.GeoProjection = d3Geo.geoAzimuthalEquidistant();
let conicConformal: d3Geo.GeoConicProjection = d3Geo.geoConicConformal();
const conicEqualArea: d3Geo.GeoConicProjection = d3Geo.geoConicEqualArea();
const conicEquidistant: d3Geo.GeoConicProjection = d3Geo.geoConicEquidistant();
const cquirectangular: d3Geo.GeoProjection = d3Geo.geoEquirectangular();
const gnomonic: d3Geo.GeoProjection = d3Geo.geoGnomonic();
const mercator: d3Geo.GeoProjection = d3Geo.geoMercator();
const orthographic: d3Geo.GeoProjection = d3Geo.geoOrthographic();
const stereographic: d3Geo.GeoProjection = d3Geo.geoStereographic();
const transverseMercator: d3Geo.GeoProjection = d3Geo.geoTransverseMercator();

// ----------------------------------------------------------------------
// Create New Projections
// ----------------------------------------------------------------------

const geoProjection: d3Geo.GeoProjection = d3Geo.geoProjection(azimuthalEqualAreaRaw);

const mutate: () => d3Geo.GeoProjection = d3Geo.geoProjectionMutator(() => azimuthalEqualAreaRaw);
let constructedProjection: d3Geo.GeoProjection = mutate();

// Use Projection ==========================================================
github d3 / d3-geo-polygon / src / airocean.js View on Github external
face = [tmp[0], centroid, tmp[2]];
    face.centroid = centroid;
    polyhedron.push(face); // face[20]

    face = [tmp[0], tmp[1], centroid];
    face.centroid = centroid;
    polyhedron.push(face); // face[21]

    // Split face 14 at the edge.
    face = polyhedron[14];
    centroid = face.centroid;
    tmp = face.slice();

    // compute planar midpoint
    var proj = gnomonic()
      .scale(1)
      .translate([0, 0])
      .rotate([-centroid[0], -centroid[1]]);
    var a = proj(face[1]),
      b = proj(face[2]);
    mid = proj.invert([(a[0] + b[0]) / 2, (a[1] + b[1]) / 2]);
    face[1] = mid; // (new) face[14]

    // build the new half face
    face = [tmp[0], tmp[1], mid];
    face.centroid = centroid; // use original face[14] centroid
    polyhedron.push(face); // face[22]

    // cut face 19 to connect to 22
    face = polyhedron[19];
    centroid = face.centroid;
github d3 / d3-geo-polygon / src / polyhedral / butterfly.js View on Github external
faceProjection = faceProjection || function(face) {
    var c = centroid({type: "MultiPoint", coordinates: face});
    return gnomonic().scale(1).translate([0, 0]).rotate([-c[0], -c[1]]);
  };
github d3 / d3-geo-polygon / src / polyhedral / voronoi.js View on Github external
var found = -1;
    for (var i = 0; i < faces.length; i++) {
      var d = distance(faces[i].site, [lambda, phi]);
      if (d < d0) {
        d0 = d;
        found = i;
      }
    }
    return found;
  }
  
  function faceFind(lambda, phi) {
    return faces[find(lambda * degrees, phi * degrees)];
  }

  var p = gnomonic();

  function reset() {
    var rotate = p.rotate(),
      translate = p.translate(),
      center = p.center(),
      scale = p.scale(),
      angle = p.angle();

    if (faces.length) {
      p = polyhedral(faces[0], faceFind);
    }

    p.parents = function(_) {
      if (!arguments.length) return parents;
      parents = _;
      build_tree();
github d3 / d3-geo-projection / src / polyhedral / waterman.js View on Github external
faceProjection = faceProjection || function(face) {
    var c = face.length === 6 ? centroid({type: "MultiPoint", coordinates: face}) : face[0];
    return gnomonic().scale(1).translate([0, 0]).rotate([-c[0], -c[1]]);
  };
github d3 / d3-geo-polygon / src / polyhedral / voronoi.js View on Github external
function(face) {
      return gnomonic()
        .scale(1)
        .translate([0, 0])
        .rotate([-face.site[0], -face.site[1]]);
    };
github d3 / d3-geo-polygon / src / polyhedral / waterman.js View on Github external
faceProjection = faceProjection || function(face) {
    var c = face.length === 6 ? centroid({type: "MultiPoint", coordinates: face}) : face[0];
    return gnomonic().scale(1).translate([0, 0]).rotate([-c[0], -c[1]]);
  };
github d3 / d3-geo-projection / src / polyhedral / butterfly.js View on Github external
faceProjection = faceProjection || function(face) {
    var c = centroid({type: "MultiPoint", coordinates: face});
    return gnomonic().scale(1).translate([0, 0]).rotate([-c[0], -c[1]]);
  };