globeRadiusPixels
The radius of the globe on the screen, in pixels, at a normalised zoom and view centre latitude.
This is a function exported by @mapcairn/core, checked against version 0.2.0.
Signature
import { globeRadiusPixels } from "@mapcairn/core";
function globeRadiusPixels(normalisedZoom: number, centreLatitude: number): number;
Parameters
normalisedZoom(number)centreLatitude(number)
Returns
number
Remarks
MapLibre GL JS 6.17 (getGlobeRadiusPixels in
src/geo/projection/globe_utils.ts) sizes the globe as
worldSize / (2π) / planetScaleAtLatitude(centre), where
planetScaleAtLatitude is the cosine of the centre latitude, clamped at
Mercator's limit, so that a feature at the centre is the same size on the
globe as on the flat map. MapLibre's worldSize is 512 * 2 ** zoom in
its own zoom, which is 256 * 2 ** zoom in the normalised zoom.