Skip to content
glyphcss

Projections

Loading terrain…

Pick a projection to morph the same ETOPO1 terrain into it. Drag to orbit the globe or pan a flat map.

import {
glyphMapGlobe, glyphMapEquirectangular,
glyphMapMercator, glyphMapOrthographic,
} from "@glyphcss/maps";
const projection = glyphMapGlobe({ radius: 1, exaggeration: 24 });
glyphMapEquirectangular({ exaggeration: 24 });
glyphMapMercator({ maxLat: 85.05112877980659, exaggeration: 24 });
glyphMapOrthographic({ lon0: 0, lat0: 0, exaggeration: 24 });
ProjectionUseDefaults / limits
glyphMapGlobeOrbit a sphereradius: 1; far hemisphere hidden
glyphMapEquirectangularFlat longitude/latitude mapFull world
glyphMapMercatorFlat map with enlarged polar regionsmaxLat: 85.05112877980659; poles excluded
glyphMapOrthographicFixed hemisphere on a flat disclon0: 0, lat0: 0; far hemisphere excluded

All options are optional. exaggeration defaults to 1 (true-scale relief); 24 makes terrain easier to see. Built-in building extrusions keep true-metre heights regardless of exaggeration.

import { geoMollweideRaw } from "d3-geo-projection";
import { glyphMapFromD3Raw } from "@glyphcss/maps";
const mollweide = glyphMapFromD3Raw(geoMollweideRaw, { exaggeration: 24 });

Install d3-geo-projection separately. The adapter accepts id, domain, and exaggeration; defaults are "glyph-map-d3-raw", the full world, and 1. The raw projection needs .invert for unprojection; otherwise unproject throws TypeError.

For your own GlyphMapProjection, supply id, domain, exaggeration, project(lon, lat, elev), and unproject(world). Coordinates use degrees; elevation uses metres. Return non-finite coordinates outside the domain. Optional visible, cameraForCenter, and centerForCamera support hemisphere visibility and orbit navigation.

await map.setProjection(glyphMapGlobe({ exaggeration: 24 }), { durationMs: 900 });

The current centre stays anchored. Use durationMs: 0 for an immediate change. Changing projection leaves walk mode.