How to use the d3-geo.geoCircle 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 / d3-geo / d3-geo-tests.ts View on Github external
const rotation: d3Geo.GeoRotation = d3Geo.geoRotation([90, 45]);
const rotation2: d3Geo.GeoRotation = d3Geo.geoRotation([90, 45, 27.5]);

// use rotation --------------------------------------------------------

const point: [number, number] = rotation([54, 2]);
const inverted: [number, number] = rotation.invert([54, 2]);

// ----------------------------------------------------------------------
// Spherical Shapes - geoCircle
// ----------------------------------------------------------------------

// Create GeoCircleGenerator ============================================

// simple use case
let circleGeneratorSimple: d3Geo.GeoCircleGenerator = d3Geo.geoCircle();

// complex use as part of object
class Circulator {
    constructor(radius: number, precision: number) {
        this.r = radius;
        this.p = precision;
        this.circleGenerator = d3Geo.geoCircle()
            .radius(function(datum) {
                const t: Circulator = this;
                const d: [number, number] | undefined = datum;
                return this.r;
            })
            .precision(function(datum) {
                const t: Circulator = this;
                const d: [number, number] | undefined = datum;
                return this.p;
github DefinitelyTyped / DefinitelyTyped / types / d3-geo / d3-geo-tests.ts View on Github external
const rotation: d3Geo.GeoRotation = d3Geo.geoRotation([90, 45]);
const rotation2: d3Geo.GeoRotation = d3Geo.geoRotation([90, 45, 27.5]);

// use rotation --------------------------------------------------------

const point: [number, number] = rotation([54, 2]);
const inverted: [number, number] = rotation.invert([54, 2]);

// ----------------------------------------------------------------------
// Spherical Shapes - geoCircle
// ----------------------------------------------------------------------

// Create GeoCircleGenerator ============================================

// simple use case
let circleGeneratorSimple: d3Geo.GeoCircleGenerator = d3Geo.geoCircle();

// complex use as part of object
class Circulator {
    constructor(radius: number, precision: number) {
        this.r = radius;
        this.p = precision;
        this.circleGenerator = d3Geo.geoCircle()
            .radius(function(datum) {
                const t: Circulator = this;
                const d: [number, number] | undefined = datum;
                return this.r;
            })
            .precision(function(datum) {
                const t: Circulator = this;
                const d: [number, number] | undefined = datum;
                return this.p;
github d3 / d3-geo-projection / src / hammerRetroazimuthal.js View on Github external
export default function() {
  var phi0 = 0,
      m = projectionMutator(hammerRetroazimuthalRaw),
      p = m(phi0),
      rotate_ = p.rotate,
      stream_ = p.stream,
      circle = geoCircle();

  p.parallel = function(_) {
    if (!arguments.length) return phi0 * degrees;
    var r = p.rotate();
    return m(phi0 = _ * radians).rotate(r);
  };

  // Temporary hack; see hammerRetroazimuthalRotation.
  p.rotate = function(_) {
    if (!arguments.length) return (_ = rotate_.call(p), _[1] += phi0 * degrees, _);
    rotate_.call(p, [_[0], _[1] - phi0 * degrees]);
    circle.center([-_[0], -_[1]]);
    return p;
  };

  p.stream = function(stream) {
github DefinitelyTyped / DefinitelyTyped / d3-geo / d3-geo-tests.ts View on Github external
constructor(radius: number, precision: number) {
        this.r = radius;
        this.p = precision;
        this.circleGenerator = d3Geo.geoCircle()
            .radius(function(datum) {
                const t: Circulator = this;
                const d: [number, number] | undefined = datum;
                return this.r;
            })
            .precision(function(datum) {
                const t: Circulator = this;
                const d: [number, number] | undefined = datum;
                return this.p;
            })
            .center(function(datum) {
                const t: Circulator = this;
                const d: [number, number] | undefined = datum;
                return d ? d : [0, 0];
            });
    }
github DefinitelyTyped / DefinitelyTyped / types / d3-geo / d3-geo-tests.ts View on Github external
constructor(radius: number, precision: number) {
        this.r = radius;
        this.p = precision;
        this.circleGenerator = d3Geo.geoCircle()
            .radius(function(datum) {
                const t: Circulator = this;
                const d: [number, number] | undefined = datum;
                return this.r;
            })
            .precision(function(datum) {
                const t: Circulator = this;
                const d: [number, number] | undefined = datum;
                return this.p;
            })
            .center(function(datum) {
                const t: Circulator = this;
                const d: [number, number] | undefined = datum;
                return d ? d : [0, 0];
            });
    }
github amcharts / amcharts4 / dist / es2015 / .internal / charts / map / MapUtils.js View on Github external
export function getCircle(longitude, latitude, radius) {
    return [d3geo.geoCircle().center([longitude, latitude]).radius(radius)().coordinates];
}
/**
github joelburget / d4 / demo / now.js View on Github external
import React from 'react';
import {geoAzimuthalEquidistant, geoPath, geoGraticule, geoCircle} from 'd3-geo';
import {utcDay} from 'd3-time';
import topojson from 'topojson';

import world from '../data/world-50m.json';

const width = 700;
const height = 700;

const pi = Math.PI;
const radians = pi / 180;
const degrees = 180 / pi;

const circle = geoCircle()
  .radius(90);

const projection = geoAzimuthalEquidistant()
  .scale(85)
  .translate([width / 2, height / 2])
  .clipAngle(180 - 1e-3)
  .rotate([0, 90])
  .precision(.1);

const path = geoPath()
  .projection(projection);

const graticule = geoGraticule();

export default function World() {
  const now = new Date();
github amcharts / amcharts4 / src / .internal / charts / map / MapUtils.ts View on Github external
export function getCircle(longitude: number, latitude: number, radius: number): Array>> {
	return [d3geo.geoCircle().center([longitude, latitude]).radius(radius)().coordinates as Array>];
}