d3-geo-projection
Extended geographic projections for d3-geo.
Installing
If you use NPM, npm install d3-geo-projection
. Otherwise, download the latest release. You can also load directly from d3js.org as a standalone library. AMD, CommonJS, and vanilla environments are supported. In vanilla, a d3
global is exported:
<script src="https://d3js.org/d3-array.v1.min.js"></script>
<script src="https://d3js.org/d3-geo.v1.min.js"></script>
<script src="https://d3js.org/d3-geo-projection.v1.min.js"></script>
<script>
var aitoff = d3.geoAitoff();
</script>
Try d3-geo-projection in your browser.
API Reference
Projections
# d3.geoAitoff()
The Aitoff projection.
# d3.geoAiry()
Airy’s minimum-error azimuthal projection.
# airy.radius([radius])
Defaults to 90°.
# d3.geoAlbers()
Alber’s equal-area conic projection; see d3-geo.
# d3.geoArmadillo()
The armadillo projection. The default center assumes the default parallel of 20° and should be changed if a different parallel is used. Note: requires clipping to the sphere.
# armadillo.parallel([parallel])
Defaults to 20°.
# d3.geoAugust()
August’s epicycloidal conformal projection.
# d3.geoAzimuthalEqualArea()
The Lambert azimuthal equal-area projection; see d3-geo.
# d3.geoAzimuthalEquidistant()
The azimuthal equidistant projection; see d3-geo.
# d3.geoBaker()
The Baker Dinomic projection.
# d3.geoBerghaus()
Berghaus’ star projection. The default center assumes the default lobe number of 5 and should be changed if a different number of lobes is used. Note: requires clipping to the sphere.
# berghaus.lobes([lobes])
If lobes is specified, sets the number of lobes in the resulting star, and returns this projection. If lobes is not specified, returns the current lobe number, which defaults to 5.
# d3.geoBoggs()
The Boggs eumorphic projection. More commonly used in interrupted form.
# d3.geoBonne()
The Bonne pseudoconical equal-area projection. The Werner projection is a limiting form of the Bonne projection with a standard parallel at ±90°. The default center assumes the default parallel of 45° and should be changed if a different parallel is used.
# bonne.parallel([parallel])
Defaults to 45°.
# d3.geoBottomley()
The Bottomley projection “draws lines of latitude as concentric circular arcs, with arc lengths equal to their lengths on the globe, and placed symmetrically and equally spaced across the vertical central meridian.”
# bottomley.fraction([fraction])
Defaults to 0.5, corresponding to a sin(ψ) where ψ = π/6.
# d3.geoBromley()
The Bromley projection is a rescaled Mollweide projection.
# d3.geoChamberlin(point0, point1, point2)
The Chamberlin trimetric projection. This method does not support projection.rotate: the three reference points implicitly determine a fixed rotation.
# d3.geoChamberlinAfrica()
The Chamberlin projection for Africa using points [0°, 22°], [45°, 22°], [22.5°, -22°].
# d3.geoCollignon()
The Collignon equal-area pseudocylindrical projection. This projection is used in the polar areas of the HEALPix projection.
# d3.geoConicConformal()
The Lambert conformal conic projection; see d3-geo.
# d3.geoConicEqualArea()
Alber’s conic equal-area projection; see d3-geo.
# d3.geoConicEquidistant()
The conic equidistant projection; see d3-geo.
# d3.geoCraig()
The Craig retroazimuthal projection. Note: this projection tends to fold over itself if the standard parallel is non-zero; we have not yet implemented the necessary advanced clipping to avoid overlap.
# craig.parallel([parallel])
Defaults to 0°.
# d3.geoCraster()
The Craster parabolic projection; also known as Putniņš P4.
# d3.geoCylindricalEqualArea()
The cylindrical equal-area projection. Depending on the chosen parallel, this projection is also known as the Lambert cylindrical equal-area (0°), Gall–Peters (45°), Hobo–Dyer (37.5°), and Tobler world-in-a-square (~55.654°).
# cylindricalEqualArea.parallel([parallel])
Defaults to approximately 38.58°, fitting the world in a 960×500 rectangle.
# d3.geoCylindricalStereographic()
The cylindrical stereographic projection. Depending on the chosen parallel, this projection is also known as Braun’s stereographic (0°) and Gall’s stereographic (45°).
# cylindricalStereographic.parallel([parallel])
Defaults to 0°.
# d3.geoEckert1()
The Eckert I projection.
# d3.geoEckert2()
The Eckert II projection.
# d3.geoEckert3()
The Eckert III projection.
# d3.geoEckert4()
The Eckert IV projection.
# d3.geoEckert5()
The Eckert V projection.
# d3.geoEckert6()
The Eckert VI projection.
# d3.geoEisenlohr()
The Eisenlohr conformal projection.
# d3.geoEquirectangular()
The equirectangular (plate carrée) projection; see d3-geo. The Cassini projection is the transverse aspect of the equirectangular projection.
# d3.geoFahey()
The Fahey pseudocylindrical projection.
# d3.geoFoucaut()
Foucaut’s stereographic equivalent projection.
# d3.geoGilbert([type])
Gilbert’s two-world perspective projection. Wraps an instance of the specified projection type; if not specified, defaults to d3.geoOrthographic.
# d3.geoGingery()
The U.S.-centric Gingery world projection, as inspired by Cram’s Air Age. Note: requires clipping to the sphere.
# gingery.radius([radius])
Defaults to 30°.
# gingery.lobes([lobes])
Defaults to 6.
# d3.geoGinzburg4()
The Ginzburg IV projection.
# d3.geoGinzburg5()
The Ginzburg V projection.
# d3.geoGinzburg6()
The Ginzburg VI projection.
# d3.geoGinzburg8()
The Ginzburg VIII projection.
# d3.geoGinzburg9()
The Ginzburg IX projection.
# d3.geoGnomonic()
The gnomonic projection; see d3-geo.
# d3.geoGringorten()
The Gringorten square equal-area projection, rearranged to give each hemisphere an entire square.
# d3.geoGringortenQuincuncial()
The Gringorten square equal-area projection.
# d3.geoGuyou()
The Guyou hemisphere-in-a-square projection. Peirce is credited with its quincuncial form.
# d3.geoHammer()
The Hammer projection. Depending the chosen coefficient and aspect, also known as Eckert–Greifendorff, quartic authalic, and Briesemeister.
# hammer.coefficient([coefficient])
Defaults to 2.
# d3.geoHammerRetroazimuthal()
The Hammer retroazimuthal projection. Note: requires clipping to the sphere.
# hammerRetroazimuthal.parallel([parallel])
Defaults to 45°.
# d3.geoHealpix()
The HEALPix projection: a Hierarchical Equal Area isoLatitude Pixelisation of a 2-sphere. In this implementation, the parameter K is fixed at 3. Note: requires clipping to the sphere.
# healpix.lobes([lobes])
If lobes is specified, sets the number of lobes (the parameter H in the literature) and returns this projection. If lobes is not specified, returns the current lobe number, which defaults to 4.
# d3.geoHill()
Hill eucyclic projection is psuedoconic and equal-area.
# hill.ratio([ratio])
Defaults to 1. With a ratio of 0, this projection becomes the Maurer No. 73. As it approaches ∞, the projection converges to the Eckert IV.
# d3.geoHomolosine()
The pseudocylindrical, equal-area Goode homolosine projection is normally presented in interrupted form.
# d3.geoKavrayskiy7()
The Kavrayskiy VII pseudocylindrical projection.
# d3.geoLagrange()
The Lagrange conformal projection.
# lagrange.spacing([spacing])
Defaults to 0.5.
# d3.geoLarrivee()
The Larrivée projection.
# d3.geoLaskowski()
The Laskowski tri-optimal projection simultaneously minimizes distance, angular, and areal distortion.
# d3.geoLittrow()
The Littrow projection is the only conformal retroazimuthal map projection. Typically clipped to the geographic extent [[-90°, -60°], [90°, 60°]].
# d3.geoLoximuthal()
The loximuthal projection is “characterized by the fact that loxodromes (rhumb lines) from one chosen central point (the intersection of the central meridian and central latitude) are shown as straight lines, correct in azimuth from the center, and are ‘true to scale’… It is neither an equal-area projection nor conformal.”
# loximuthal.parallel([parallel])
Defaults to 40°.
# d3.geoMercator()
The spherical Mercator projection; see d3-geo.
# d3.geoMiller()
The Miller cylindrical projection is a modified Mercator projection.
# d3.geoModifiedStereographic(coefficients, rotate)
The family of modified stereographic projections. The default clip angle for these projections is 90°. These projections do not support projection.rotate: a fixed rotation is applied that is specific to the given coefficients.
# d3.geoModifiedStereographicAlaska()
A modified stereographic projection for Alaska.
# d3.geoModifiedStereographicGs48()
A modified stereographic projection for the conterminous United States.
# d3.geoModifiedStereographicGs50()
A modified stereographic projection for the United States including Alaska and Hawaii. Typically clipped to the geographic extent [[-180°, 15°], [-50°, 75°]].
# d3.geoModifiedStereographicMiller()
A modified stereographic projection for Europe and Africa. Typically clipped to the geographic extent [[-40°, -40°], [80°, 80°]].
# d3.geoModifiedStereographicLee()
A modified stereographic projection for the Pacific ocean.
# d3.geoMollweide()
The equal-area, pseudocylindrical Mollweide projection. The oblique aspect is known as the Atlantis projection. Goode’s interrupted Mollweide is also widely known.
# d3.geoMtFlatPolarParabolic()
The McBryde–Thomas flat-polar parabolic pseudocylindrical equal-area projection.
# d3.geoMtFlatPolarQuartic()
The McBryde–Thomas flat-polar quartic pseudocylindrical equal-area projection.
# d3.geoMtFlatPolarSinusoidal()
The McBryde–Thomas flat-polar sinusoidal equal-area projection.
# d3.geoNaturalEarth()
The Natural Earth projection.
# d3.geoNellHammer()
The Nell–Hammer projection.
# d3.geoOrthographic()
The orthographic projection; see d3-geo.
# d3.geoPatterson()
The Patterson cylindrical projection.
# d3.geoPeirceQuincuncial()
The Peirce quincuncial projection is the quincuncial form of the Guyou projection.
# d3.geoPolyconic()
The American polyconic projection.
# d3.geoRectangularPolyconic()
The rectangular (War Office) polyconic projection.
# rectangularPolyconic.parallel([parallel])
Defaults to 0°.
# d3.geoRobinson()
The Robinson projection.
# d3.geoSatellite()
The satellite (tilted perspective) projection.
# satellite.tilt([tilt])
Defaults to 0°.
# satellite.distance([distance])
Distance from the center of the sphere to the point of view, as a proportion of the sphere’s radius; defaults to 2.0. The recommended maximum clip angle for a given distance is acos(1 / distance) converted to degrees. If tilt is also applied, then more conservative clipping may be necessary. For exact clipping, the in-development geographic projection pipeline is needed; see the satellite example.
# d3.geoSinusoidal()
The sinusoidal projection.
# d3.geoSinuMollweide()
Allen K. Philbrick’s Sinu-Mollweide projection. See also the interrupted form.
# d3.geoStereographic()
The stereographic projection; see d3-geo.
# d3.geoTimes()
John Muir’s Times projection.
# d3.geoTransverseMercator()
The transverse spherical Mercator projection; see d3-geo.
# d3.geoTwoPointAzimuthal(point0, point1)
The two-point azimuthal projection “shows correct azimuths (but not distances) from either of two points to any other point. [It can] be used to locate a ship at sea, given the exact location of two radio transmitters and the direction of the ship to the transmitters.” This projection does not support projection.rotate, as the rotation is fixed by the two given points.
# d3.geoTwoPointAzimuthalUsa()
The two-point azimuthal projection with points [-158°, 21.5°] and [-77°, 39°], approximately representing Honolulu, HI and Washington, D.C.
# d3.geoTwoPointEquidistant(point0, point1)
The two-point equidistant projection. This projection does not support projection.rotate, as the rotation is fixed by the two given points. Note: to show the whole Earth, this projection requires clipping to spherical polygons, which is not yet supported in D3. However, you can typically show most of the Earth by using D3’s great-circle clipping.
# d3.geoTwoPointEquidistantUsa()
The two-point equidistant projection with points [-158°, 21.5°] and [-77°, 39°], approximately representing Honolulu, HI and Washington, D.C.
# d3.geoVanDerGrinten()
The Van der Grinten projection.
# d3.geoVanDerGrinten2()
The Van der Grinten II projection.
# d3.geoVanDerGrinten3()
The Van der Grinten III projection.
# d3.geoVanDerGrinten4()
The Van der Grinten IV projection.
# d3.geoWagner4()
The Wagner IV projection, also known as Putniṇš P2´.
# d3.geoWagner6()
The Wagner VI projection.
# d3.geoWagner7()
The Wagner VII projection.
# d3.geoWiechel()
The Wiechel projection.
# d3.geoWinkel3()
The Winkel tripel projection.
Interrupted Projections
# d3.geoInterrupt(project, lobes)
Defines a new interrupted projection for the specified raw projection function project and the specified array of lobes. The array lobes contains two elements representing the hemilobes for the northern hemisphere and the southern hemisphere, respectively. Each hemilobe is an array of triangles, with each triangle represented as three points (in degrees): the start, midpoint, and end. For example, the lobes in Goode’s interrupted homolosine projection are defined as:
[
[
[[-180, 0], [-100, 90], [ -40, 0]],
[[ -40, 0], [ 30, 90], [ 180, 0]]
],
[
[[-180, 0], [-160, -90], [-100, 0]],
[[-100, 0], [ -60, -90], [ -20, 0]],
[[ -20, 0], [ 20, -90], [ 80, 0]],
[[ 80, 0], [ 140, -90], [ 180, 0]]
]
]
Note: interrupted projections typically require clipping to the sphere.
# d3.geoInterruptedHomolosine()
Goode’s interrupted homolosine projection.
# d3.geoInterruptedSinusoidal()
An interrupted sinusoidal projection with asymmetrical lobe boundaries that emphasize land masses over oceans, after the Swedish Nordisk Världs Atlas as reproduced by C.A. Furuti.
# d3.geoInterruptedBoggs()
Bogg’s interrupted eumorphic projection.
# d3.geoInterruptedSinuMollweide()
Alan K. Philbrick’s interrupted sinu-Mollweide projection.
# d3.geoInterruptedMollweide()
Goode’s interrupted Mollweide projection.
# d3.geoInterruptedMollweideHemispheres()
The Mollweide projection interrupted into two (equal-area) hemispheres.
Raw Projections
Raw projections are used to implement projections; they typically passed to d3.geoProjection or d3.geoProjectionMutator. They are exposed here to facilitate the derivation of related projections. Raw projections define simple point transformations: they take spherical coordinates [lambda, phi] in radians and return a point [x, y], typically in the unit square centered around the origin.
# project(lambda, phi)
Projects the specified point [lambda, phi] in radians, returning a new point [x, y] in unitless coordinates.
# project.invert(x, y)
The inverse of project.
# d3.geoAiryRaw(beta)
# d3.geoAitoffRaw
# d3.geoArmadilloRaw(phi0)
# d3.geoAugustRaw
# d3.geoBakerRaw
# d3.geoBerghausRaw(lobes)
# d3.geoBoggsRaw
# d3.geoBonneRaw(phi0)
# d3.geoBottomleyRaw(sinPsi)
# d3.geoBromleyRaw
# d3.geoChamberlinRaw(p0, p1, p2)
# d3.geoCollignonRaw
# d3.geoCraigRaw(phi)
# d3.geoCrasterRaw
# d3.geoCylindricalEqualAreaRaw(phi0)
# d3.geoCylindricalStereographicRaw(phi0)
# d3.geoEckert1Raw
# d3.geoEckert2Raw
# d3.geoEckert3Raw
# d3.geoEckert4Raw
# d3.geoEckert5Raw
# d3.geoEckert6Raw
# d3.geoFaheyRaw
# d3.geoGingeryRaw(rho, lobes)
# d3.geoGinzburg4Raw
# d3.geoGinzburg5Raw
# d3.geoGinzburg6Raw
# d3.geoGinzburg8Raw
# d3.geoGinzburg9Raw
# d3.geoHammerRaw(A, B)
# d3.geoHammerRetroazimuthalRaw(phi0)
# d3.geoHillRaw(K)
# d3.geoHomolosineRaw
# d3.geoKavrayskiy7Raw
# d3.geoLagrangeRaw(n)
# d3.geoLarriveeRaw
# d3.geoLaskowskiRaw
# d3.geoLittrowRaw
# d3.geoLoximuthalRaw(phi0)
# d3.geoMillerRaw
# d3.geoModifiedStereographicRaw(coefficients)
# d3.geoMollweideRaw
# d3.geoMtFlatPolarParabolicRaw
# d3.geoMtFlatPolarQuarticRaw
# d3.geoMtFlatPolarSinusoidalRaw
# d3.geoNaturalEarthRaw
# d3.geoNellHammerRaw
# d3.geoPattersonRaw
# d3.geoPolyconicRaw
# d3.geoRectangularPolyconicRaw(phi0)
# d3.geoSatelliteRaw(P, omega)
# d3.geoSinuMollweideRaw
# d3.geoSinusoidalRaw
# d3.geoTimesRaw
# d3.geoTwoPointAzimuthalRaw(d)
# d3.geoTwoPointEquidistantRaw(z0)
# d3.geoVanDerGrinten2Raw
# d3.geoVanDerGrinten3Raw
# d3.geoVanDerGrinten4Raw
# d3.geoVanDerGrintenRaw
# d3.geoWagner4Raw
# d3.geoWagner6Raw
# d3.geoWagner7Raw
# d3.geoWiechelRaw
# d3.geoWinkel3Raw