Skip to main content
100%

Projection Contexts

✓ Published0🌍 Public
Mmbostock
Last edited Sep 29, 2012
Created on Sep 29, 2012

This example demonstrates composable context wrappers for custom geographic projections in D3. It shows how d3.geoPath’s streaming geometry output can be intercepted at multiple stages—first through a radians-and-rotate context, then through a project-and-transform context, and finally through an antimeridian-intersection handler that splits lines crossing the ±180° meridian. The projection.line method chains these contexts to convert spherical coordinates to planar canvas coordinates. The code relies on D3’s geo-projection internals and the Canvas 2D context, illustrating a low-level approach for building tailored projection pipelines.

AI-generated description

Similar vizzes