Export Code
Connected
index.js
import {
select,
json,
geoOrthographic,
geoPath,
zoom,
drag,
} from 'd3';

const svg = select('svg');
const path = svg.append('path');
const projection = geoOrthographic();
const initialScale = projection
.fitWidth(960, { type: 'Sphere' })
.scale();

const geo = geoPath().projection(projection);
const sensitivity = 58;

const jsonURL =
'https://unpkg.com/world-atlas@2.0.2/countries-110m.json';

const main = async () => {
const world = await json(jsonURL);

const land = topojson.feature(
world,
world.objects.land
);
const render = () => path.attr('d', geo(land));
render();
svg
.call(
drag().on('drag', (event) => {
const rotate = projection.rotate();
const scale = projection.scale();

Panning & Zooming on a Globe - old

Curran Kelleher

Last edited Sep 02, 2023
Created on Aug 30, 2022
Forked from D3 Starter

An updated version of Orthographic Zoom I.

See also iterated versions:

MIT Licensed