Lawrence  Lesch

Lawrence Lesch

1656474900

D3-geo-projection: Extended Geographic Projections for D3-geo

d3-geo-projection

Extended geographic projections for d3-geo

Installing

If you use npm, npm install d3-geo-projection. You can also download the latest release on GitHub. For vanilla HTML in modern browsers, import d3-geo-projection from Skypack:

<script type="module">

import {geoAitoff} from "https://cdn.skypack.dev/d3-geo-projection@4";

const projection = geoAitoff();

</script>

For legacy environments, you can load d3-geo-projection’s UMD bundle from an npm-based CDN such as jsDelivr; a d3 global is exported:

<script src="https://cdn.jsdelivr.net/npm/d3-array@3"></script>
<script src="https://cdn.jsdelivr.net/npm/d3-geo@3"></script>
<script src="https://cdn.jsdelivr.net/npm/d3-geo-projection@4"></script>
<script>

const projection = d3.geoAitoff();

</script>

API Reference

Projections

Note: projections tagged [d3-geo] are exported by d3-geo, not d3-geo-projection. These commonly-used projections are also included in the d3 default bundle.

# d3.geoAiry() · Source, Examples 
# d3.geoAiryRaw(beta)

Airy’s minimum-error azimuthal projection.

# airy.radius([radius])

Defaults to 90°.

# d3.geoAitoff() · Source, Examples 
# d3.geoAitoffRaw

The Aitoff projection.

# d3.geoAlbers() · Source [d3-geo]

Albers’ equal-area conic projection.

# d3.geoArmadillo() · Source, Examples 
# d3.geoArmadilloRaw(phi0)

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() · Source, Examples 
# d3.geoAugustRaw

August’s epicycloidal conformal projection.

# d3.geoAzimuthalEqualArea() · Source [d3-geo], Examples 
# d3.geoAzimuthalEqualAreaRaw

The Lambert azimuthal equal-area projection.

# d3.geoAzimuthalEquidistant() · Source [d3-geo], Examples 
# d3.geoAzimuthalEquidistantRaw

The azimuthal equidistant projection.

# d3.geoBaker() · Source, Examples 
# d3.geoBakerRaw

The Baker Dinomic projection.

# d3.geoBerghaus() · Source, Examples 
# d3.geoBerghausRaw(lobes)

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]) · Source

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.geoBertin1953() · Source 
# d3.geoBertin1953Raw

Jacques Bertin’s 1953 projection.

# d3.geoBoggs() · Source, Examples 
# d3.geoBoggsRaw

The Boggs eumorphic projection. More commonly used in interrupted form.

# d3.geoBonne() · Source, Examples 
# d3.geoBonneRaw(phi0)

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() · Source, Examples 
# d3.geoBottomleyRaw(sinPsi)

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() · Source, Examples 
# d3.geoBromleyRaw

The Bromley projection is a rescaled Mollweide projection.

# d3.geoChamberlin(point0, point1, point2) · Source 
# d3.geoChamberlinRaw(p0, p1, p2)

The Chamberlin trimetric projection. This method does not support projection.rotate: the three reference points implicitly determine a fixed rotation.

# d3.geoChamberlinAfrica() · Source

The Chamberlin projection for Africa using points [0°, 22°], [45°, 22°], [22.5°, -22°].

# d3.geoCollignon() · Source, Examples 
# d3.geoCollignonRaw

The Collignon equal-area pseudocylindrical projection. This projection is used in the polar areas of the HEALPix projection.

# d3.geoConicConformal() · Source [d3-geo], Examples 
# d3.geoConicConformalRaw

The Lambert conformal conic projection.

# d3.geoConicEqualArea() · Source [d3-geo], Examples 
# d3.geoConicEqualAreaRaw

Albers’ conic equal-area projection.

# d3.geoConicEquidistant() · Source [d3-geo], Examples 
# d3.geoConicEquidistantRaw

The conic equidistant projection.

# d3.geoCraig() · Source, Examples 
# d3.geoCraigRaw(phi)

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() · Source, Examples 
# d3.geoCrasterRaw

The Craster parabolic projection; also known as Putniņš P4.

# d3.geoCylindricalEqualArea() · Source, Examples 
# d3.geoCylindricalEqualAreaRaw(phi0)

The cylindrical equal-area projection. Depending on the chosen parallel, this projection is also known as the Lambert cylindrical equal-area (0°), Behrmann (30°), Hobo–Dyer (37.5°), Gall–Peters (45°), Balthasart (50°) 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() · Source, Examples 
# d3.geoCylindricalStereographicRaw(phi0)

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() · Source, Examples 
# d3.geoEckert1Raw

The Eckert I projection.

# d3.geoEckert2() · Source, Examples 
# d3.geoEckert2Raw

The Eckert II projection.

# d3.geoEckert3() · Source, Examples 
# d3.geoEckert3Raw

The Eckert III projection.

# d3.geoEckert4() · Source, Examples 
# d3.geoEckert4Raw

The Eckert IV projection.

# d3.geoEckert5() · Source, Examples 
# d3.geoEckert5Raw

The Eckert V projection.

# d3.geoEckert6() · Source, Examples 
# d3.geoEckert6Raw

The Eckert VI projection.

# d3.geoEisenlohr() · Source, Examples 
# d3.geoEisenlohrRaw(lambda, phi)

The Eisenlohr conformal projection.

# d3.geoEquirectangular() · Source [d3-geo], Examples 
# d3.geoEquirectangularRaw

The equirectangular (plate carrée) projection. The Cassini projection is the transverse aspect of the equirectangular projection.

# d3.geoFahey() · Source, Examples 
# d3.geoFaheyRaw

The Fahey pseudocylindrical projection.

# d3.geoFoucaut() · Source, Examples 
# d3.geoFoucautRaw

Foucaut’s stereographic equivalent projection.

# d3.geoFoucautSinusoidal() · Source, Examples 
# d3.geoFoucautSinusoidalRaw

Foucaut’s sinusoidal projection, an equal-area average of the sinusoidal and Lambert’s cylindrical projections.

# foucautSinusoidal.alpha([alpha])

Relative weight of the cylindrical projection. Defaults to 0.5.

# d3.geoGilbert([type]) · Source, Examples

Gilbert’s two-world perspective projection. Wraps an instance of the specified projection type; if not specified, defaults to d3.geoOrthographic.

# d3.geoGingery() · Source, Examples 
# d3.geoGingeryRaw(rho, lobes)

The U.S.-centric Gingery world projection, as inspired by Cram’s Air Age. Note: requires clipping to the sphere.

# gingery.radius([radius]) · Source

Defaults to 30°.

# gingery.lobes([lobes]) · Source

Defaults to 6.

# d3.geoGinzburg4() · Source, Examples 
# d3.geoGinzburg4Raw

The Ginzburg IV projection.

# d3.geoGinzburg5() · Source, Examples 
# d3.geoGinzburg5Raw

The Ginzburg V projection.

# d3.geoGinzburg6() · Source, Examples 
# d3.geoGinzburg6Raw

The Ginzburg VI projection.

# d3.geoGinzburg8() · Source, Examples 
# d3.geoGinzburg8Raw

The Ginzburg VIII projection.

# d3.geoGinzburg9() · Source, Examples 
# d3.geoGinzburg9Raw

The Ginzburg IX projection.

# d3.geoGnomonic() · Source [d3-geo], Examples 
# d3.geoGnomonicRaw

The gnomonic projection.

# d3.geoGringorten() · Source, Examples 
# d3.geoGringortenRaw

The Gringorten square equal-area projection, rearranged to give each hemisphere an entire square.

# d3.geoGuyou() · Source, Examples 
# d3.geoGuyouRaw

The Guyou hemisphere-in-a-square projection. Peirce is credited with its quincuncial form.

# d3.geoHammer() · Source, Examples 
# d3.geoHammerRaw(A, B)

The Hammer projection. Depending the chosen coefficient and aspect, also known as Eckert–Greifendorff, quartic authalic, and Briesemeister.

# hammer.coefficient([coefficient]) · Source

Defaults to 2.

# d3.geoHammerRetroazimuthal() · Source, Examples 
# d3.geoHammerRetroazimuthalRaw(phi0)

The Hammer retroazimuthal projection. Note: requires clipping to the sphere.

# hammerRetroazimuthal.parallel([parallel])

Defaults to 45°.

# d3.geoHealpix() · Source, Examples 
# d3.geoHealpixRaw(lobes)

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() · Source, Examples 
# d3.geoHillRaw(K)

Hill eucyclic projection is pseudoconic 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() · Source, Examples 
# d3.geoHomolosineRaw

The pseudocylindrical, equal-area Goode homolosine projection is normally presented in interrupted form.

# d3.geoHufnagel() · Source, Examples 
# d3.geoHufnagelRaw

A customizable family of pseudocylindrical equal-area projections by Herbert Hufnagel.

# hufnagel.a([a])

# hufnagel.b([b])

# hufnagel.psiMax([psiMax])

# hufnagel.ratio([ratio])

# d3.geoHyperelliptical() · Source, Examples 
# d3.geoHyperellipticalRaw

Waldo R. Tobler’s hyperelliptical is a family of equal-area pseudocylindrical projections. Parameters include k, the exponent of the superellipse (or Lamé curve) that defines the shape of the meridians (default k = 2.5); alpha, which governs the weight of the cylindrical projection that is averaged with the superellipse (default alpha = 0); and gamma, that shapes the aspect ratio (default: gamma = 1.183136).

# d3.geoKavrayskiy7() · Source, Examples 
# d3.geoKavrayskiy7Raw

The Kavrayskiy VII pseudocylindrical projection.

# d3.geoLagrange() · Source, Examples 
# d3.geoLagrangeRaw(n)

The Lagrange conformal projection.

# lagrange.spacing([spacing])

Defaults to 0.5.

# d3.geoLarrivee() · Source, Examples 
# d3.geoLarriveeRaw

The Larrivée projection.

# d3.geoLaskowski() · Source, Examples 
# d3.geoLaskowskiRaw

The Laskowski tri-optimal projection simultaneously minimizes distance, angular, and areal distortion.

# d3.geoLittrow() · Source, Examples 
# d3.geoLittrowRaw

The Littrow projection is the only conformal retroazimuthal map projection. Typically clipped to the geographic extent [[-90°, -60°], [90°, 60°]].

# d3.geoLoximuthal() · Source, Examples 
# d3.geoLoximuthalRaw(phi0)

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() · Source [d3-geo], Examples 
# d3.geoMercatorRaw

The spherical Mercator projection.

# d3.geoMiller() · Source, Examples 
# d3.geoMillerRaw

The Miller cylindrical projection is a modified Mercator projection.

# d3.geoModifiedStereographic(coefficients, rotate) · Source 
# d3.geoModifiedStereographicRaw(coefficients)

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() · Source

A modified stereographic projection for Alaska.

# d3.geoModifiedStereographicGs48() · Source

A modified stereographic projection for the conterminous United States.

# d3.geoModifiedStereographicGs50() · Source

A modified stereographic projection for the United States including Alaska and Hawaii. Typically clipped to the geographic extent [[-180°, 15°], [-50°, 75°]].

# d3.geoModifiedStereographicMiller() · Source, Examples

A modified stereographic projection for Europe and Africa. Typically clipped to the geographic extent [[-40°, -40°], [80°, 80°]].

# d3.geoModifiedStereographicLee() · Source, Examples

A modified stereographic projection for the Pacific ocean.

# d3.geoMollweide() · Source, Examples 
# d3.geoMollweideRaw

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() · Source, Examples 
# d3.geoMtFlatPolarParabolicRaw

The McBryde–Thomas flat-polar parabolic pseudocylindrical equal-area projection.

# d3.geoMtFlatPolarQuartic() · Source, Examples 
# d3.geoMtFlatPolarQuarticRaw

The McBryde–Thomas flat-polar quartic pseudocylindrical equal-area projection.

# d3.geoMtFlatPolarSinusoidal() · Source, Examples 
# d3.geoMtFlatPolarSinusoidalRaw

The McBryde–Thomas flat-polar sinusoidal equal-area projection.

# d3.geoNaturalEarth1() · Source [d3-geo], Examples 
# d3.geoNaturalEarth1Raw

The Natural Earth projection.

# d3.geoNaturalEarth2() · Source, Examples 
# d3.geoNaturalEarth2Raw

The Natural Earth II projection. Compared to Natural Earth, it is slightly taller and rounder.

# d3.geoNellHammer() · Source, Examples 
# d3.geoNellHammerRaw

The Nell–Hammer projection.

# d3.geoNicolosi() · Source, Examples 
# d3.geoNicolosiRaw

The Nicolosi globular projection.

# d3.geoOrthographic() · Source [d3-geo], Examples 
# d3.geoOrthographicRaw

The orthographic projection.

# d3.geoPatterson() · Source, Examples 
# d3.geoPattersonRaw

The Patterson cylindrical projection.

# d3.geoPolyconic() · Source, Examples 
# d3.geoPolyconicRaw

The American polyconic projection.

# d3.geoRectangularPolyconic() · Source, Examples 
# d3.geoRectangularPolyconicRaw(phi0)

The rectangular (War Office) polyconic projection.

# rectangularPolyconic.parallel([parallel])

Defaults to 0°.

# d3.geoRobinson() · Source, Examples 
# d3.geoRobinsonRaw

The Robinson projection.

# d3.geoSatellite() · Source, Examples 
# d3.geoSatelliteRaw(P, omega)

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 explorer.

# d3.geoSinusoidal() · Source, Examples 
# d3.geoSinusoidalRaw

The sinusoidal projection.

# d3.geoSinuMollweide() · Source, Examples 
# d3.geoSinuMollweideRaw

Allen K. Philbrick’s Sinu-Mollweide projection. See also the interrupted form.

# d3.geoStereographic() · Source [d3-geo], Examples 
# d3.geoStereographicRaw

The stereographic projection.

# d3.geoTimes() · Source, Examples 
# d3.geoTimesRaw

John Muir’s Times projection.

# d3.geoTransverseMercator() · Source [d3-geo], Examples 
# d3.geoTransverseMercatorRaw

The transverse spherical Mercator projection.

# d3.geoTwoPointAzimuthal(point0, point1) · Source 
# d3.geoTwoPointAzimuthalRaw(d)

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() · Source

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) · Source 
# d3.geoTwoPointEquidistantRaw(z0)

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 (example).

# d3.geoTwoPointEquidistantUsa() · Source

The two-point equidistant projection with points [-158°, 21.5°] and [-77°, 39°], approximately representing Honolulu, HI and Washington, D.C.

# d3.geoVanDerGrinten() · Source, Examples 
# d3.geoVanDerGrintenRaw

The Van der Grinten projection.

# d3.geoVanDerGrinten2() · Source, Examples 
# d3.geoVanDerGrinten2Raw

The Van der Grinten II projection.

# d3.geoVanDerGrinten3() · Source, Examples 
# d3.geoVanDerGrinten3Raw

The Van der Grinten III projection.

# d3.geoVanDerGrinten4() · Source, Examples 
# d3.geoVanDerGrinten4Raw

The Van der Grinten IV projection.

# d3.geoWagner() · Source, Examples 
# d3.geoWagnerRaw

The Wagner projection is customizable: default values produce the Wagner VIII projection.

# wagner.poleline([poleline])

Defaults to 65°.

# wagner.parallels([parallels])

Defaults to 60°.

# wagner.inflation([inflation])

Defaults to 20.

# wagner.ratio([ratio])

Defaults to 200.

# d3.geoWagner4() · Source, Examples 
# d3.geoWagner4Raw

The Wagner IV projection, also known as Putniṇš P2´.

# d3.geoWagner6() · Source, Examples 
# d3.geoWagner6Raw

The Wagner VI projection.

# d3.geoWagner7() · Source, Examples

The Wagner VII projection.

# d3.geoWiechel() · Source, Examples 
# d3.geoWiechelRaw

The Wiechel projection.

# d3.geoWinkel3() · Source, Examples 
# d3.geoWinkel3Raw

The Winkel tripel projection.

Interrupted Projections

# d3.geoInterrupt(project, lobes) · Source, Examples

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.

# interrupted.lobes([lobes]) · Source

If lobes is specified, sets the new array of hemilobes and returns this projection; see d3.geoInterrupt for details on the format of the hemilobes array. If lobes is not specified, returns the current array of hemilobes.

# d3.geoInterruptedHomolosine() · Source, Examples

Goode’s interrupted homolosine projection. Its ocean-centric aspect is also well-known.

# d3.geoInterruptedSinusoidal() · Source, Examples

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() · Source, Examples

Bogg’s interrupted eumorphic projection.

# d3.geoInterruptedSinuMollweide() · Source, Examples

Alan K. Philbrick’s interrupted sinu-Mollweide projection.

# d3.geoInterruptedMollweide() · Source, Examples

Goode’s interrupted Mollweide projection.

# d3.geoInterruptedMollweideHemispheres() · Source, Examples

The Mollweide projection interrupted into two (equal-area) hemispheres.

# d3.geoInterruptedQuarticAuthalic() · Source, Examples

The quartic authalic projection interrupted into two hemispheres.

Polyhedral Projections

# d3.geoPolyhedral(root, face) · Source

Defines a new polyhedral projection. The root is a spanning tree of polygon face nodes; each node is assigned a node.transform matrix. The face function returns the appropriate node for a given lambda and phi in radians. Use projection.angle to set the orientation of the map (the default angle, -30°, might change in the next major version).

# d3.geoPolyhedralButterfly() · Source, Examples

The gnomonic butterfly projection.

# d3.geoPolyhedralCollignon() · Source, Examples

The Collignon butterfly projection.

# d3.geoPolyhedralWaterman() · Source, Examples

Steve Waterman’s butterfly projection.

Quincuncial Projections

# d3.geoQuincuncial(project) · Source

Defines a new quincuncial projection for the specified raw projection function project. The default rotation is [-90°, -90°, 45°] and the default clip angle is 180° - ε.

# d3.geoGringortenQuincuncial() · Source

The Gringorten square equal-area projection.

# d3.geoPeirceQuincuncial() · Source

The Peirce quincuncial projection is the quincuncial form of the Guyou projection.

Transformations

# d3.geoProject(object, projection) · Source

Projects the specified GeoJSON object using the specified projection, returning a shallow copy of the specified GeoJSON object with projected coordinates. Typically, the input coordinates are spherical and the output coordinates are planar, but the projection can also be an arbitrary geometric transformation.

See also geoproject.

# d3.geoStitch(object) · Source

Returns a shallow copy of the specified GeoJSON object, removing antimeridian and polar cuts, and replacing straight Cartesian line segments with geodesic segments. The input object must have coordinates in longitude and latitude in decimal degrees per RFC 7946. Antimeridian cutting, if needed, can then be re-applied after rotating to the desired projection aspect.

See also geostitch.

# d3.geoQuantize(object, digits) · Source

Returns a shallow copy of the specified GeoJSON object, rounding x and y coordinates according to number.toFixed. Typically this is done after projecting.

See also geoproject --precision and geo2svg --precision.

Command-Line Reference

geo2svg

# geo2svg [options…] [file] · Source

Converts the specified GeoJSON file to SVG. With --newline-delimited, each input feature is rendered as a separate path element; otherwise, a single path element is generated.

By default, the SVG’s fill is set to none and the stroke is set to black. The default point radius is 4.5. To override these values on a per-feature basis, the following GeoJSON feature properties will be propagated to attributes:

  • fill
  • fill-rule (or fillRule)
  • fill-opacity (or fillOpacity)
  • stroke
  • stroke-width (or strokeWidth)
  • stroke-linecap (or strokeLinecap)
  • stroke-linejoin (or strokeLinejoin)
  • stroke-miterlimit (or strokeMiterlimit)
  • stroke-dasharray (or strokeDasharray)
  • stroke-dashoffset (or strokeDashoffset)
  • stroke-opacity (or strokeOpacity)
  • point-radius (or pointRadius)

If the feature has an id, the path element will have a corresponding id attribute. If the feature has a title property, the path element will have a title element with the corresponding value. For an example of per-feature attributes, see this California population density map.

Note: per-feature attributes are most useful in conjunction with newline-delimited input, as otherwise the generated SVG only has a single path element. To set these properties dynamically, pass the input through ndjson-map.

# geo2svg -h 
# geo2svg --help

Output usage information.

# geo2svg -V 
# geo2svg --version

Output the version number.

# geo2svg -o file 
# geo2svg --out file

Specify the output file name. Defaults to “-” for stdout.

# geo2svg -w value 
# geo2svg --width value

Specify the output width. Defaults to 960.

# geo2svg -h value 
# geo2svg --height value

Specify the output height. Defaults to 500.

# geo2svg -p value 
# geo2svg --precision value

Reduce the precision for smaller output files. Defaults to six digits after the decimal point. See also d3.geoQuantize.

# geo2svg --fill value

Specify the default output fill color. Defaults to none.

# geo2svg --stroke value

Specify the default output stroke color. Defaults to black.

# geo2svg --r value 
# geo2svg --radius value

Specify the default output point radius. Defaults to 4.5.

# geo2svg -n 
# geo2svg --newline-delimited

Accept newline-delimited JSON as input, with one feature per line.

geograticule

# geograticule [options…] · Source

Generates a GeoJSON graticule. See also d3.geoGraticule.

# geograticule -h 
# geograticule --help

Output usage information.

# geograticule -V 
# geograticule --version

Output the version number.

# geograticule -o file 
# geograticule --out file

Specify the output file name. Defaults to “-” for stdout.

# geograticule --extent value

Sets the graticule’s extent.

# geograticule --extent-minor value

Sets the graticule’s minor extent.

# geograticule --extent-major value

Sets the graticule’s major extent.

# geograticule --step value

Sets the graticule’s step.

# geograticule --step-minor value

Sets the graticule’s minor step.

# geograticule --step-major value

Sets the graticule’s major setp.

# geograticule --precision value

Sets the graticule’s precision.

geoproject

# geoproject [options…] projection [file] · Source

Projects the GeoJSON object in the specified input file using the specified projection, outputting a new GeoJSON object with projected coordinates. For example, to project standard WGS 84 input using d3.geoAlbersUsa:

geoproject 'd3.geoAlbersUsa()' us.json \
  > us-albers.json

For geometry that crosses the antimeridian or surrounds a pole, you will want to pass input through geostitch first:

geostitch world.json \
  | geoproject 'd3.geoMercator()' \
  > world-mercator.json

Typically, the input coordinates are spherical and the output coordinates are planar, but the projection can also be an arbitrary geometric transformation. For example, to invert the y-axis of a standard spatial reference system such as California Albers (EPSG:3310) and fit it to a 960×500 viewport:

shp2json planar.shp \
  | geoproject 'd3.geoIdentity().reflectY(true).fitSize([960, 500], d)' \
  > planar.json

See also d3.geoProject and d3.geoIdentity.

# geoproject -h 
# geoproject --help

Output usage information.

# geoproject -V 
# geoproject --version

Output the version number.

# geoproject -o file 
# geoproject --out file

Specify the output file name. Defaults to “-” for stdout.

# geoproject -p value 
# geoproject --precision value

Reduce the precision for smaller output files. See also d3.geoQuantize.

# geoproject -n 
# geoproject --newline-delimited

Accept newline-delimited JSON as input, with one feature per line, and generate newline-delimited JSON as output.

# geoproject -r [name=]value 
# geoproject --require [name=]value

Requires the specified module, making it available for use in any expressions used by this command. The loaded module is available as the symbol name. If name is not specified, it defaults to module. (If module is not a valid identifier, you must specify a name.) For example, to reproject the world on the Airocean projection:

geoproject --require d3=d3-geo-polygon 'd3.geoAirocean()' world.geojson

The required module is resolved relative to the current working directory. If the module is not found during normal resolution, the global npm root is also searched, allowing you to require globally-installed modules from the command line.

Multiple modules can be required by repeating this option.

geoquantize

# geoquantize [options…] [file] · Source

Reads the GeoJSON object from the specified input file and outputs a new GeoJSON object with coordinates reduced to precision. Same options as geoproject.

geoquantize us.json --precision 3 \
  > us-quantized.json

geostitch

# geostitch [options…] [file] · Source

Stitches the GeoJSON object in the specified input file, removing antimeridian and polar cuts, and replacing straight Cartesian line segments with geodesic segments. The input object must have coordinates in longitude and latitude in decimal degrees per RFC 7946. Antimeridian cutting, if needed, can then be re-applied after rotating to the desired projection aspect.

See geoproject for an example. See also d3.geoStitch.

# geostitch -h 
# geostitch --help

Output usage information.

# geostitch -V 
# geostitch --version

Output the version number.

# geostitch -o file 
# geostitch --out file

Specify the output file name. Defaults to “-” for stdout.

# geostitch -n 
# geostitch --newline-delimited

Accept newline-delimited JSON as input, with one feature per line, and generate newline-delimited JSON as output.

See Command-Line Cartography for an introduction.

Author: d3
Source Code: https://github.com/d3/d3-geo-projection 
License: View license

#javascript #3d #map 

What is GEEK

Buddha Community

D3-geo-projection: Extended Geographic Projections for D3-geo
Autumn  Blick

Autumn Blick

1593867420

Top Android Projects with Source Code

Android Projects with Source Code – Your entry pass into the world of Android

Hello Everyone, welcome to this article, which is going to be really important to all those who’re in dilemma for their projects and the project submissions. This article is also going to help you if you’re an enthusiast looking forward to explore and enhance your Android skills. The reason is that we’re here to provide you the best ideas of Android Project with source code that you can choose as per your choice.

These project ideas are simple suggestions to help you deal with the difficulty of choosing the correct projects. In this article, we’ll see the project ideas from beginners level and later we’ll move on to intermediate to advance.

top android projects with source code

Android Projects with Source Code

Before working on real-time projects, it is recommended to create a sample hello world project in android studio and get a flavor of project creation as well as execution: Create your first android project

Android Projects for beginners

1. Calculator

build a simple calculator app in android studio source code

Android Project: A calculator will be an easy application if you have just learned Android and coding for Java. This Application will simply take the input values and the operation to be performed from the users. After taking the input it’ll return the results to them on the screen. This is a really easy application and doesn’t need use of any particular package.

To make a calculator you’d need Android IDE, Kotlin/Java for coding, and for layout of your application, you’d need XML or JSON. For this, coding would be the same as that in any language, but in the form of an application. Not to forget creating a calculator initially will increase your logical thinking.

Once the user installs the calculator, they’re ready to use it even without the internet. They’ll enter the values, and the application will show them the value after performing the given operations on the entered operands.

Source Code: Simple Calculator Project

2. A Reminder App

Android Project: This is a good project for beginners. A Reminder App can help you set reminders for different events that you have throughout the day. It’ll help you stay updated with all your tasks for the day. It can be useful for all those who are not so good at organizing their plans and forget easily. This would be a simple application just whose task would be just to remind you of something at a particular time.

To make a Reminder App you need to code in Kotlin/Java and design the layout using XML or JSON. For the functionality of the app, you’d need to make use of AlarmManager Class and Notifications in Android.

In this, the user would be able to set reminders and time in the application. Users can schedule reminders that would remind them to drink water again and again throughout the day. Or to remind them of their medications.

3. Quiz Application

Android Project: Another beginner’s level project Idea can be a Quiz Application in android. Here you can provide the users with Quiz on various general knowledge topics. These practices will ensure that you’re able to set the layouts properly and slowly increase your pace of learning the Android application development. In this you’ll learn to use various Layout components at the same time understanding them better.

To make a quiz application you’ll need to code in Java and set layouts using xml or java whichever you prefer. You can also use JSON for the layouts whichever preferable.

In the app, questions would be asked and answers would be shown as multiple choices. The user selects the answer and gets shown on the screen if the answers are correct. In the end the final marks would be shown to the users.

4. Simple Tic-Tac-Toe

android project tic tac toe game app

Android Project: Tic-Tac-Toe is a nice game, I guess most of you all are well aware of it. This will be a game for two players. In this android game, users would be putting X and O in the given 9 parts of a box one by one. The first player to arrange X or O in an adjacent line of three wins.

To build this game, you’d need Java and XML for Android Studio. And simply apply the logic on that. This game will have a set of three matches. So, it’ll also have a scoreboard. This scoreboard will show the final result at the end of one complete set.

Upon entering the game they’ll enter their names. And that’s when the game begins. They’ll touch one of the empty boxes present there and get their turn one by one. At the end of the game, there would be a winner declared.

Source Code: Tic Tac Toe Game Project

5. Stopwatch

Android Project: A stopwatch is another simple android project idea that will work the same as a normal handheld timepiece that measures the time elapsed between its activation and deactivation. This application will have three buttons that are: start, stop, and hold.

This application would need to use Java and XML. For this application, we need to set the timer properly as it is initially set to milliseconds, and that should be converted to minutes and then hours properly. The users can use this application and all they’d need to do is, start the stopwatch and then stop it when they are done. They can also pause the timer and continue it again when they like.

6. To Do App

Android Project: This is another very simple project idea for you as a beginner. This application as the name suggests will be a To-Do list holding app. It’ll store the users schedules and their upcoming meetings or events. In this application, users will be enabled to write their important notes as well. To make it safe, provide a login page before the user can access it.

So, this app will have a login page, sign-up page, logout system, and the area to write their tasks, events, or important notes. You can build it in android studio using Java and XML at ease. Using XML you can build the user interface as user-friendly as you can. And to store the users’ data, you can use SQLite enabling the users to even delete the data permanently.

Now for users, they will sign up and get access to the write section. Here the users can note down the things and store them permanently. Users can also alter the data or delete them. Finally, they can logout and also, login again and again whenever they like.

7. Roman to decimal converter

Android Project: This app is aimed at the conversion of Roman numbers to their significant decimal number. It’ll help to check the meaning of the roman numbers. Moreover, it will be easy to develop and will help you get your hands on coding and Android.

You need to use Android Studio, Java for coding and XML for interface. The application will take input from the users and convert them to decimal. Once it converts the Roman no. into decimal, it will show the results on the screen.

The users are supposed to just enter the Roman Number and they’ll get the decimal values on the screen. This can be a good android project for final year students.

8. Virtual Dice Roller

Android Project: Well, coming to this part that is Virtual Dice or a random no. generator. It is another simple but interesting app for computer science students. The only task that it would need to do would be to generate a number randomly. This can help people who’re often confused between two or more things.

Using a simple random number generator you can actually create something as good as this. All you’d need to do is get you hands-on OnClick listeners. And a good layout would be cherry on the cake.

The user’s task would be to set the range of the numbers and then click on the roll button. And the app will show them a randomly generated number. Isn’t it interesting ? Try soon!

9. A Scientific Calculator App

Android Project: This application is very important for you as a beginner as it will let you use your logical thinking and improve your programming skills. This is a scientific calculator that will help the users to do various calculations at ease.

To make this application you’d need to use Android Studio. Here you’d need to use arithmetic logics for the calculations. The user would need to give input to the application that will be in terms of numbers. After that, the user will give the operator as an input. Then the Application will calculate and generate the result on the user screen.

10. SMS App

Android Project: An SMS app is another easy but effective idea. It will let you send the SMS to various no. just in the same way as you use the default messaging application in your phone. This project will help you with better understanding of SMSManager in Android.

For this application, you would need to implement Java class SMSManager in Android. For the Layout you can use XML or JSON. Implementing SMSManager into the app is an easy task, so you would love this.

The user would be provided with the facility to text to whichever number they wish also, they’d be able to choose the numbers from the contact list. Another thing would be the Textbox, where they’ll enter their message. Once the message is entered they can happily click on the send button.

#android tutorials #android application final year project #android mini projects #android project for beginners #android project ideas #android project ideas for beginners #android projects #android projects for students #android projects with source code #android topics list #intermediate android projects #real-time android projects

Shawn  Durgan

Shawn Durgan

1595547778

10 Writing steps to create a good project brief - Mobile app development

Developing a mobile application can often be more challenging than it seems at first glance. Whether you’re a developer, UI designer, project lead or CEO of a mobile-based startup, writing good project briefs prior to development is pivotal. According to Tech Jury, 87% of smartphone users spend time exclusively on mobile apps, with 18-24-year-olds spending 66% of total digital time on mobile apps. Of that, 89% of the time is spent on just 18 apps depending on individual users’ preferences, making proper app planning crucial for success.

Today’s audiences know what they want and don’t want in their mobile apps, encouraging teams to carefully write their project plans before they approach development. But how do you properly write a mobile app development brief without sacrificing your vision and staying within the initial budget? Why should you do so in the first place? Let’s discuss that and more in greater detail.

Why a Good Mobile App Project Brief Matters?

Why-a-Good-Mobile-App-Project-Brief-Matters

It’s worth discussing the significance of mobile app project briefs before we tackle the writing process itself. In practice, a project brief is used as a reference tool for developers to remain focused on the client’s deliverables. Approaching the development process without written and approved documentation can lead to drastic, last-minute changes, misunderstanding, as well as a loss of resources and brand reputation.

For example, developing a mobile app that filters restaurants based on food type, such as Happy Cow, means that developers should stay focused on it. Knowing that such and such features, UI elements, and API are necessary will help team members collaborate better in order to meet certain expectations. Whether you develop an app under your brand’s banner or outsource coding and design services to would-be clients, briefs can provide you with several benefits:

  • Clarity on what your mobile app project “is” and “isn’t” early in development
  • Point of reference for developers, project leads, and clients throughout the cycle
  • Smart allocation of available time and resources based on objective development criteria
  • Streamlined project data storage for further app updates and iterations

Writing Steps to Create a Good Mobile App Project Brief

Writing-Steps-to-Create-a-Good-Mobile-App-Project-Brief

1. Establish the “You” Behind the App

Depending on how “open” your project is to the public, you will want to write a detailed section about who the developers are. Elements such as company name, address, project lead, project title, as well as contact information, should be included in this introductory segment. Regardless of whether you build an in-house app or outsource developers to a client, this section is used for easy document storage and access.

#android app #ios app #minimum viable product (mvp) #mobile app development #web development #how do you write a project design #how to write a brief #how to write a project summary #how to write project summary #program brief example #project brief #project brief example #project brief template #project proposal brief #simple project brief template

Ray  Patel

Ray Patel

1619636760

42 Exciting Python Project Ideas & Topics for Beginners [2021]

Python Project Ideas

Python is one of the most popular programming languages currently. It looks like this trend is about to continue in 2021 and beyond. So, if you are a Python beginner, the best thing you can do is work on some real-time Python project ideas.

We, here at upGrad, believe in a practical approach as theoretical knowledge alone won’t be of help in a real-time work environment. In this article, we will be exploring some interesting Python project ideas which beginners can work on to put their Python knowledge to test. In this article, you will find 42 top python project ideas for beginners to get hands-on experience on Python

Moreover, project-based learning helps improve student knowledge. That’s why all of the upGrad courses cover case studies and assignments based on real-life problems. This technique is ideally for, but not limited to, beginners in programming skills.

But first, let’s address the more pertinent question that must be lurking in your mind:

#data science #python project #python project ideas #python project ideas for beginners #python project topics #python projects #python projects for beginners

A 4-Step Guide to Help Beginners Get Started on Coding Projects

Starting something new is always difficult. When I working on my first coding project, I was wondering where to begin. I wondered what technologies I should use and whether I would come up with a good project idea. Today we will be going over my beginner’s guide to coding projects. I want to help you answer the same questions I asked myself when I worked on my first project. This will be especially helpful for people with little to no experience working on coding projects. If this post is helpful, please consider subscribing to my YouTube channel or check out my other articles for more content like this!

If you do not have any experience coding, that is completely fine! I recommend you take one of these free, online courses that will teach you the fundamentals of programming and a programming language: Java (commonly used to develop Android apps, web backends, etc.), Python (commonly used for data science and backend web development), HTML + CSS + JavaScript (used for frontend and backend web development).

1. Identify Your Technologies

I recommend mostly using technologies you are familiar with. You can use at most one or two new technologies. This will add some challenge to the project to encourage you to pick them up as you go, but will not overwhelm you such that you will not be able to make progress. In addition to establishing technologies, you also want to decide on the format of the project. This could be a web app, mobile app, database project, etc — this may also influence what technologies you need to use.

2. Come Up With an Idea

I recommend keeping things simple here. When I was working on my first project, I would keep questioning my ideas. I kept trying to build something innovative, but eventually, I understood that this was not the goal of the project. I should not judge the success of this project on how many users I have or whether I can build the next billion dollar company with it. The goal of this project is for you to learn and so long as you achieve that, the project is a success. Some common ideas for a first project include a personal website, simple mobile app, or following a tutorial and building on top of that.

3. Work on the Project

You need to find what motivates you to work on the project. You want to be working on it regularly. Also, you will inevitably get stuck trying to figure something out or debugging your project. It is important to remember that everyone faces this and that there are plenty of resources out there to help. For example, simply searching the question you have or the error message you received can yield answers. Websites such as Stack Overflow were built to allow the community to help coders who are encountering a blocker. Use these sites to get unblocked and you will be on your way to completing that project.

4. Share Your Project on GitHub

GitHub is a website that allows anyone to view and collaborate on open source projects. GitHub splits these up into repositories of files that make up the project itself. If you have never used git (a version control system) or GitHub, then I recommend reading this guide which will run you through the basics.

Once your project is complete, you should put up your project in one or more repositories on GitHub. This helps for two main reasons. First, you can easily share your projects with others. All it takes is sharing the link to your GitHub profile on your resume for recruiters, hiring managers, interviewers, and more to view your projects. Second, if you are working on a website, GitHub pages takes care of hosting the website for you. All you need to do is upload your files to a GitHub repository, set it up with GitHub pages, and your website will be published at .github.io.

Source of Image

I hope you found this story informative! Please share it with a friend you think might benefit from it as well! If you liked the post/video, feel free to like and subscribe to my YouTube account and check out my other articles for more content like this. Also, follow me on Twitter for updates on when I am posting new content and check me out on Instagram. I hope to see you all on the next one!

If you prefer to follow along via my YouTube video, you can watch it here!

#side-project #project-planning #programming #coding #side-projects #build-a-side-project #how-to-start-coding-projects #self-improvement

Lawrence  Lesch

Lawrence Lesch

1656474900

D3-geo-projection: Extended Geographic Projections for D3-geo

d3-geo-projection

Extended geographic projections for d3-geo

Installing

If you use npm, npm install d3-geo-projection. You can also download the latest release on GitHub. For vanilla HTML in modern browsers, import d3-geo-projection from Skypack:

<script type="module">

import {geoAitoff} from "https://cdn.skypack.dev/d3-geo-projection@4";

const projection = geoAitoff();

</script>

For legacy environments, you can load d3-geo-projection’s UMD bundle from an npm-based CDN such as jsDelivr; a d3 global is exported:

<script src="https://cdn.jsdelivr.net/npm/d3-array@3"></script>
<script src="https://cdn.jsdelivr.net/npm/d3-geo@3"></script>
<script src="https://cdn.jsdelivr.net/npm/d3-geo-projection@4"></script>
<script>

const projection = d3.geoAitoff();

</script>

API Reference

Projections

Note: projections tagged [d3-geo] are exported by d3-geo, not d3-geo-projection. These commonly-used projections are also included in the d3 default bundle.

# d3.geoAiry() · Source, Examples 
# d3.geoAiryRaw(beta)

Airy’s minimum-error azimuthal projection.

# airy.radius([radius])

Defaults to 90°.

# d3.geoAitoff() · Source, Examples 
# d3.geoAitoffRaw

The Aitoff projection.

# d3.geoAlbers() · Source [d3-geo]

Albers’ equal-area conic projection.

# d3.geoArmadillo() · Source, Examples 
# d3.geoArmadilloRaw(phi0)

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() · Source, Examples 
# d3.geoAugustRaw

August’s epicycloidal conformal projection.

# d3.geoAzimuthalEqualArea() · Source [d3-geo], Examples 
# d3.geoAzimuthalEqualAreaRaw

The Lambert azimuthal equal-area projection.

# d3.geoAzimuthalEquidistant() · Source [d3-geo], Examples 
# d3.geoAzimuthalEquidistantRaw

The azimuthal equidistant projection.

# d3.geoBaker() · Source, Examples 
# d3.geoBakerRaw

The Baker Dinomic projection.

# d3.geoBerghaus() · Source, Examples 
# d3.geoBerghausRaw(lobes)

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]) · Source

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.geoBertin1953() · Source 
# d3.geoBertin1953Raw

Jacques Bertin’s 1953 projection.

# d3.geoBoggs() · Source, Examples 
# d3.geoBoggsRaw

The Boggs eumorphic projection. More commonly used in interrupted form.

# d3.geoBonne() · Source, Examples 
# d3.geoBonneRaw(phi0)

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() · Source, Examples 
# d3.geoBottomleyRaw(sinPsi)

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() · Source, Examples 
# d3.geoBromleyRaw

The Bromley projection is a rescaled Mollweide projection.

# d3.geoChamberlin(point0, point1, point2) · Source 
# d3.geoChamberlinRaw(p0, p1, p2)

The Chamberlin trimetric projection. This method does not support projection.rotate: the three reference points implicitly determine a fixed rotation.

# d3.geoChamberlinAfrica() · Source

The Chamberlin projection for Africa using points [0°, 22°], [45°, 22°], [22.5°, -22°].

# d3.geoCollignon() · Source, Examples 
# d3.geoCollignonRaw

The Collignon equal-area pseudocylindrical projection. This projection is used in the polar areas of the HEALPix projection.

# d3.geoConicConformal() · Source [d3-geo], Examples 
# d3.geoConicConformalRaw

The Lambert conformal conic projection.

# d3.geoConicEqualArea() · Source [d3-geo], Examples 
# d3.geoConicEqualAreaRaw

Albers’ conic equal-area projection.

# d3.geoConicEquidistant() · Source [d3-geo], Examples 
# d3.geoConicEquidistantRaw

The conic equidistant projection.

# d3.geoCraig() · Source, Examples 
# d3.geoCraigRaw(phi)

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() · Source, Examples 
# d3.geoCrasterRaw

The Craster parabolic projection; also known as Putniņš P4.

# d3.geoCylindricalEqualArea() · Source, Examples 
# d3.geoCylindricalEqualAreaRaw(phi0)

The cylindrical equal-area projection. Depending on the chosen parallel, this projection is also known as the Lambert cylindrical equal-area (0°), Behrmann (30°), Hobo–Dyer (37.5°), Gall–Peters (45°), Balthasart (50°) 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() · Source, Examples 
# d3.geoCylindricalStereographicRaw(phi0)

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() · Source, Examples 
# d3.geoEckert1Raw

The Eckert I projection.

# d3.geoEckert2() · Source, Examples 
# d3.geoEckert2Raw

The Eckert II projection.

# d3.geoEckert3() · Source, Examples 
# d3.geoEckert3Raw

The Eckert III projection.

# d3.geoEckert4() · Source, Examples 
# d3.geoEckert4Raw

The Eckert IV projection.

# d3.geoEckert5() · Source, Examples 
# d3.geoEckert5Raw

The Eckert V projection.

# d3.geoEckert6() · Source, Examples 
# d3.geoEckert6Raw

The Eckert VI projection.

# d3.geoEisenlohr() · Source, Examples 
# d3.geoEisenlohrRaw(lambda, phi)

The Eisenlohr conformal projection.

# d3.geoEquirectangular() · Source [d3-geo], Examples 
# d3.geoEquirectangularRaw

The equirectangular (plate carrée) projection. The Cassini projection is the transverse aspect of the equirectangular projection.

# d3.geoFahey() · Source, Examples 
# d3.geoFaheyRaw

The Fahey pseudocylindrical projection.

# d3.geoFoucaut() · Source, Examples 
# d3.geoFoucautRaw

Foucaut’s stereographic equivalent projection.

# d3.geoFoucautSinusoidal() · Source, Examples 
# d3.geoFoucautSinusoidalRaw

Foucaut’s sinusoidal projection, an equal-area average of the sinusoidal and Lambert’s cylindrical projections.

# foucautSinusoidal.alpha([alpha])

Relative weight of the cylindrical projection. Defaults to 0.5.

# d3.geoGilbert([type]) · Source, Examples

Gilbert’s two-world perspective projection. Wraps an instance of the specified projection type; if not specified, defaults to d3.geoOrthographic.

# d3.geoGingery() · Source, Examples 
# d3.geoGingeryRaw(rho, lobes)

The U.S.-centric Gingery world projection, as inspired by Cram’s Air Age. Note: requires clipping to the sphere.

# gingery.radius([radius]) · Source

Defaults to 30°.

# gingery.lobes([lobes]) · Source

Defaults to 6.

# d3.geoGinzburg4() · Source, Examples 
# d3.geoGinzburg4Raw

The Ginzburg IV projection.

# d3.geoGinzburg5() · Source, Examples 
# d3.geoGinzburg5Raw

The Ginzburg V projection.

# d3.geoGinzburg6() · Source, Examples 
# d3.geoGinzburg6Raw

The Ginzburg VI projection.

# d3.geoGinzburg8() · Source, Examples 
# d3.geoGinzburg8Raw

The Ginzburg VIII projection.

# d3.geoGinzburg9() · Source, Examples 
# d3.geoGinzburg9Raw

The Ginzburg IX projection.

# d3.geoGnomonic() · Source [d3-geo], Examples 
# d3.geoGnomonicRaw

The gnomonic projection.

# d3.geoGringorten() · Source, Examples 
# d3.geoGringortenRaw

The Gringorten square equal-area projection, rearranged to give each hemisphere an entire square.

# d3.geoGuyou() · Source, Examples 
# d3.geoGuyouRaw

The Guyou hemisphere-in-a-square projection. Peirce is credited with its quincuncial form.

# d3.geoHammer() · Source, Examples 
# d3.geoHammerRaw(A, B)

The Hammer projection. Depending the chosen coefficient and aspect, also known as Eckert–Greifendorff, quartic authalic, and Briesemeister.

# hammer.coefficient([coefficient]) · Source

Defaults to 2.

# d3.geoHammerRetroazimuthal() · Source, Examples 
# d3.geoHammerRetroazimuthalRaw(phi0)

The Hammer retroazimuthal projection. Note: requires clipping to the sphere.

# hammerRetroazimuthal.parallel([parallel])

Defaults to 45°.

# d3.geoHealpix() · Source, Examples 
# d3.geoHealpixRaw(lobes)

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() · Source, Examples 
# d3.geoHillRaw(K)

Hill eucyclic projection is pseudoconic 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() · Source, Examples 
# d3.geoHomolosineRaw

The pseudocylindrical, equal-area Goode homolosine projection is normally presented in interrupted form.

# d3.geoHufnagel() · Source, Examples 
# d3.geoHufnagelRaw

A customizable family of pseudocylindrical equal-area projections by Herbert Hufnagel.

# hufnagel.a([a])

# hufnagel.b([b])

# hufnagel.psiMax([psiMax])

# hufnagel.ratio([ratio])

# d3.geoHyperelliptical() · Source, Examples 
# d3.geoHyperellipticalRaw

Waldo R. Tobler’s hyperelliptical is a family of equal-area pseudocylindrical projections. Parameters include k, the exponent of the superellipse (or Lamé curve) that defines the shape of the meridians (default k = 2.5); alpha, which governs the weight of the cylindrical projection that is averaged with the superellipse (default alpha = 0); and gamma, that shapes the aspect ratio (default: gamma = 1.183136).

# d3.geoKavrayskiy7() · Source, Examples 
# d3.geoKavrayskiy7Raw

The Kavrayskiy VII pseudocylindrical projection.

# d3.geoLagrange() · Source, Examples 
# d3.geoLagrangeRaw(n)

The Lagrange conformal projection.

# lagrange.spacing([spacing])

Defaults to 0.5.

# d3.geoLarrivee() · Source, Examples 
# d3.geoLarriveeRaw

The Larrivée projection.

# d3.geoLaskowski() · Source, Examples 
# d3.geoLaskowskiRaw

The Laskowski tri-optimal projection simultaneously minimizes distance, angular, and areal distortion.

# d3.geoLittrow() · Source, Examples 
# d3.geoLittrowRaw

The Littrow projection is the only conformal retroazimuthal map projection. Typically clipped to the geographic extent [[-90°, -60°], [90°, 60°]].

# d3.geoLoximuthal() · Source, Examples 
# d3.geoLoximuthalRaw(phi0)

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() · Source [d3-geo], Examples 
# d3.geoMercatorRaw

The spherical Mercator projection.

# d3.geoMiller() · Source, Examples 
# d3.geoMillerRaw

The Miller cylindrical projection is a modified Mercator projection.

# d3.geoModifiedStereographic(coefficients, rotate) · Source 
# d3.geoModifiedStereographicRaw(coefficients)

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() · Source

A modified stereographic projection for Alaska.

# d3.geoModifiedStereographicGs48() · Source

A modified stereographic projection for the conterminous United States.

# d3.geoModifiedStereographicGs50() · Source

A modified stereographic projection for the United States including Alaska and Hawaii. Typically clipped to the geographic extent [[-180°, 15°], [-50°, 75°]].

# d3.geoModifiedStereographicMiller() · Source, Examples

A modified stereographic projection for Europe and Africa. Typically clipped to the geographic extent [[-40°, -40°], [80°, 80°]].

# d3.geoModifiedStereographicLee() · Source, Examples

A modified stereographic projection for the Pacific ocean.

# d3.geoMollweide() · Source, Examples 
# d3.geoMollweideRaw

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() · Source, Examples 
# d3.geoMtFlatPolarParabolicRaw

The McBryde–Thomas flat-polar parabolic pseudocylindrical equal-area projection.

# d3.geoMtFlatPolarQuartic() · Source, Examples 
# d3.geoMtFlatPolarQuarticRaw

The McBryde–Thomas flat-polar quartic pseudocylindrical equal-area projection.

# d3.geoMtFlatPolarSinusoidal() · Source, Examples 
# d3.geoMtFlatPolarSinusoidalRaw

The McBryde–Thomas flat-polar sinusoidal equal-area projection.

# d3.geoNaturalEarth1() · Source [d3-geo], Examples 
# d3.geoNaturalEarth1Raw

The Natural Earth projection.

# d3.geoNaturalEarth2() · Source, Examples 
# d3.geoNaturalEarth2Raw

The Natural Earth II projection. Compared to Natural Earth, it is slightly taller and rounder.

# d3.geoNellHammer() · Source, Examples 
# d3.geoNellHammerRaw

The Nell–Hammer projection.

# d3.geoNicolosi() · Source, Examples 
# d3.geoNicolosiRaw

The Nicolosi globular projection.

# d3.geoOrthographic() · Source [d3-geo], Examples 
# d3.geoOrthographicRaw

The orthographic projection.

# d3.geoPatterson() · Source, Examples 
# d3.geoPattersonRaw

The Patterson cylindrical projection.

# d3.geoPolyconic() · Source, Examples 
# d3.geoPolyconicRaw

The American polyconic projection.

# d3.geoRectangularPolyconic() · Source, Examples 
# d3.geoRectangularPolyconicRaw(phi0)

The rectangular (War Office) polyconic projection.

# rectangularPolyconic.parallel([parallel])

Defaults to 0°.

# d3.geoRobinson() · Source, Examples 
# d3.geoRobinsonRaw

The Robinson projection.

# d3.geoSatellite() · Source, Examples 
# d3.geoSatelliteRaw(P, omega)

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 explorer.

# d3.geoSinusoidal() · Source, Examples 
# d3.geoSinusoidalRaw

The sinusoidal projection.

# d3.geoSinuMollweide() · Source, Examples 
# d3.geoSinuMollweideRaw

Allen K. Philbrick’s Sinu-Mollweide projection. See also the interrupted form.

# d3.geoStereographic() · Source [d3-geo], Examples 
# d3.geoStereographicRaw

The stereographic projection.

# d3.geoTimes() · Source, Examples 
# d3.geoTimesRaw

John Muir’s Times projection.

# d3.geoTransverseMercator() · Source [d3-geo], Examples 
# d3.geoTransverseMercatorRaw

The transverse spherical Mercator projection.

# d3.geoTwoPointAzimuthal(point0, point1) · Source 
# d3.geoTwoPointAzimuthalRaw(d)

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() · Source

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) · Source 
# d3.geoTwoPointEquidistantRaw(z0)

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 (example).

# d3.geoTwoPointEquidistantUsa() · Source

The two-point equidistant projection with points [-158°, 21.5°] and [-77°, 39°], approximately representing Honolulu, HI and Washington, D.C.

# d3.geoVanDerGrinten() · Source, Examples 
# d3.geoVanDerGrintenRaw

The Van der Grinten projection.

# d3.geoVanDerGrinten2() · Source, Examples 
# d3.geoVanDerGrinten2Raw

The Van der Grinten II projection.

# d3.geoVanDerGrinten3() · Source, Examples 
# d3.geoVanDerGrinten3Raw

The Van der Grinten III projection.

# d3.geoVanDerGrinten4() · Source, Examples 
# d3.geoVanDerGrinten4Raw

The Van der Grinten IV projection.

# d3.geoWagner() · Source, Examples 
# d3.geoWagnerRaw

The Wagner projection is customizable: default values produce the Wagner VIII projection.

# wagner.poleline([poleline])

Defaults to 65°.

# wagner.parallels([parallels])

Defaults to 60°.

# wagner.inflation([inflation])

Defaults to 20.

# wagner.ratio([ratio])

Defaults to 200.

# d3.geoWagner4() · Source, Examples 
# d3.geoWagner4Raw

The Wagner IV projection, also known as Putniṇš P2´.

# d3.geoWagner6() · Source, Examples 
# d3.geoWagner6Raw

The Wagner VI projection.

# d3.geoWagner7() · Source, Examples

The Wagner VII projection.

# d3.geoWiechel() · Source, Examples 
# d3.geoWiechelRaw

The Wiechel projection.

# d3.geoWinkel3() · Source, Examples 
# d3.geoWinkel3Raw

The Winkel tripel projection.

Interrupted Projections

# d3.geoInterrupt(project, lobes) · Source, Examples

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.

# interrupted.lobes([lobes]) · Source

If lobes is specified, sets the new array of hemilobes and returns this projection; see d3.geoInterrupt for details on the format of the hemilobes array. If lobes is not specified, returns the current array of hemilobes.

# d3.geoInterruptedHomolosine() · Source, Examples

Goode’s interrupted homolosine projection. Its ocean-centric aspect is also well-known.

# d3.geoInterruptedSinusoidal() · Source, Examples

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() · Source, Examples

Bogg’s interrupted eumorphic projection.

# d3.geoInterruptedSinuMollweide() · Source, Examples

Alan K. Philbrick’s interrupted sinu-Mollweide projection.

# d3.geoInterruptedMollweide() · Source, Examples

Goode’s interrupted Mollweide projection.

# d3.geoInterruptedMollweideHemispheres() · Source, Examples

The Mollweide projection interrupted into two (equal-area) hemispheres.

# d3.geoInterruptedQuarticAuthalic() · Source, Examples

The quartic authalic projection interrupted into two hemispheres.

Polyhedral Projections

# d3.geoPolyhedral(root, face) · Source

Defines a new polyhedral projection. The root is a spanning tree of polygon face nodes; each node is assigned a node.transform matrix. The face function returns the appropriate node for a given lambda and phi in radians. Use projection.angle to set the orientation of the map (the default angle, -30°, might change in the next major version).

# d3.geoPolyhedralButterfly() · Source, Examples

The gnomonic butterfly projection.

# d3.geoPolyhedralCollignon() · Source, Examples

The Collignon butterfly projection.

# d3.geoPolyhedralWaterman() · Source, Examples

Steve Waterman’s butterfly projection.

Quincuncial Projections

# d3.geoQuincuncial(project) · Source

Defines a new quincuncial projection for the specified raw projection function project. The default rotation is [-90°, -90°, 45°] and the default clip angle is 180° - ε.

# d3.geoGringortenQuincuncial() · Source

The Gringorten square equal-area projection.

# d3.geoPeirceQuincuncial() · Source

The Peirce quincuncial projection is the quincuncial form of the Guyou projection.

Transformations

# d3.geoProject(object, projection) · Source

Projects the specified GeoJSON object using the specified projection, returning a shallow copy of the specified GeoJSON object with projected coordinates. Typically, the input coordinates are spherical and the output coordinates are planar, but the projection can also be an arbitrary geometric transformation.

See also geoproject.

# d3.geoStitch(object) · Source

Returns a shallow copy of the specified GeoJSON object, removing antimeridian and polar cuts, and replacing straight Cartesian line segments with geodesic segments. The input object must have coordinates in longitude and latitude in decimal degrees per RFC 7946. Antimeridian cutting, if needed, can then be re-applied after rotating to the desired projection aspect.

See also geostitch.

# d3.geoQuantize(object, digits) · Source

Returns a shallow copy of the specified GeoJSON object, rounding x and y coordinates according to number.toFixed. Typically this is done after projecting.

See also geoproject --precision and geo2svg --precision.

Command-Line Reference

geo2svg

# geo2svg [options…] [file] · Source

Converts the specified GeoJSON file to SVG. With --newline-delimited, each input feature is rendered as a separate path element; otherwise, a single path element is generated.

By default, the SVG’s fill is set to none and the stroke is set to black. The default point radius is 4.5. To override these values on a per-feature basis, the following GeoJSON feature properties will be propagated to attributes:

  • fill
  • fill-rule (or fillRule)
  • fill-opacity (or fillOpacity)
  • stroke
  • stroke-width (or strokeWidth)
  • stroke-linecap (or strokeLinecap)
  • stroke-linejoin (or strokeLinejoin)
  • stroke-miterlimit (or strokeMiterlimit)
  • stroke-dasharray (or strokeDasharray)
  • stroke-dashoffset (or strokeDashoffset)
  • stroke-opacity (or strokeOpacity)
  • point-radius (or pointRadius)

If the feature has an id, the path element will have a corresponding id attribute. If the feature has a title property, the path element will have a title element with the corresponding value. For an example of per-feature attributes, see this California population density map.

Note: per-feature attributes are most useful in conjunction with newline-delimited input, as otherwise the generated SVG only has a single path element. To set these properties dynamically, pass the input through ndjson-map.

# geo2svg -h 
# geo2svg --help

Output usage information.

# geo2svg -V 
# geo2svg --version

Output the version number.

# geo2svg -o file 
# geo2svg --out file

Specify the output file name. Defaults to “-” for stdout.

# geo2svg -w value 
# geo2svg --width value

Specify the output width. Defaults to 960.

# geo2svg -h value 
# geo2svg --height value

Specify the output height. Defaults to 500.

# geo2svg -p value 
# geo2svg --precision value

Reduce the precision for smaller output files. Defaults to six digits after the decimal point. See also d3.geoQuantize.

# geo2svg --fill value

Specify the default output fill color. Defaults to none.

# geo2svg --stroke value

Specify the default output stroke color. Defaults to black.

# geo2svg --r value 
# geo2svg --radius value

Specify the default output point radius. Defaults to 4.5.

# geo2svg -n 
# geo2svg --newline-delimited

Accept newline-delimited JSON as input, with one feature per line.

geograticule

# geograticule [options…] · Source

Generates a GeoJSON graticule. See also d3.geoGraticule.

# geograticule -h 
# geograticule --help

Output usage information.

# geograticule -V 
# geograticule --version

Output the version number.

# geograticule -o file 
# geograticule --out file

Specify the output file name. Defaults to “-” for stdout.

# geograticule --extent value

Sets the graticule’s extent.

# geograticule --extent-minor value

Sets the graticule’s minor extent.

# geograticule --extent-major value

Sets the graticule’s major extent.

# geograticule --step value

Sets the graticule’s step.

# geograticule --step-minor value

Sets the graticule’s minor step.

# geograticule --step-major value

Sets the graticule’s major setp.

# geograticule --precision value

Sets the graticule’s precision.

geoproject

# geoproject [options…] projection [file] · Source

Projects the GeoJSON object in the specified input file using the specified projection, outputting a new GeoJSON object with projected coordinates. For example, to project standard WGS 84 input using d3.geoAlbersUsa:

geoproject 'd3.geoAlbersUsa()' us.json \
  > us-albers.json

For geometry that crosses the antimeridian or surrounds a pole, you will want to pass input through geostitch first:

geostitch world.json \
  | geoproject 'd3.geoMercator()' \
  > world-mercator.json

Typically, the input coordinates are spherical and the output coordinates are planar, but the projection can also be an arbitrary geometric transformation. For example, to invert the y-axis of a standard spatial reference system such as California Albers (EPSG:3310) and fit it to a 960×500 viewport:

shp2json planar.shp \
  | geoproject 'd3.geoIdentity().reflectY(true).fitSize([960, 500], d)' \
  > planar.json

See also d3.geoProject and d3.geoIdentity.

# geoproject -h 
# geoproject --help

Output usage information.

# geoproject -V 
# geoproject --version

Output the version number.

# geoproject -o file 
# geoproject --out file

Specify the output file name. Defaults to “-” for stdout.

# geoproject -p value 
# geoproject --precision value

Reduce the precision for smaller output files. See also d3.geoQuantize.

# geoproject -n 
# geoproject --newline-delimited

Accept newline-delimited JSON as input, with one feature per line, and generate newline-delimited JSON as output.

# geoproject -r [name=]value 
# geoproject --require [name=]value

Requires the specified module, making it available for use in any expressions used by this command. The loaded module is available as the symbol name. If name is not specified, it defaults to module. (If module is not a valid identifier, you must specify a name.) For example, to reproject the world on the Airocean projection:

geoproject --require d3=d3-geo-polygon 'd3.geoAirocean()' world.geojson

The required module is resolved relative to the current working directory. If the module is not found during normal resolution, the global npm root is also searched, allowing you to require globally-installed modules from the command line.

Multiple modules can be required by repeating this option.

geoquantize

# geoquantize [options…] [file] · Source

Reads the GeoJSON object from the specified input file and outputs a new GeoJSON object with coordinates reduced to precision. Same options as geoproject.

geoquantize us.json --precision 3 \
  > us-quantized.json

geostitch

# geostitch [options…] [file] · Source

Stitches the GeoJSON object in the specified input file, removing antimeridian and polar cuts, and replacing straight Cartesian line segments with geodesic segments. The input object must have coordinates in longitude and latitude in decimal degrees per RFC 7946. Antimeridian cutting, if needed, can then be re-applied after rotating to the desired projection aspect.

See geoproject for an example. See also d3.geoStitch.

# geostitch -h 
# geostitch --help

Output usage information.

# geostitch -V 
# geostitch --version

Output the version number.

# geostitch -o file 
# geostitch --out file

Specify the output file name. Defaults to “-” for stdout.

# geostitch -n 
# geostitch --newline-delimited

Accept newline-delimited JSON as input, with one feature per line, and generate newline-delimited JSON as output.

See Command-Line Cartography for an introduction.

Author: d3
Source Code: https://github.com/d3/d3-geo-projection 
License: View license

#javascript #3d #map