Reference · The globe as an SVG string
projectionViewfunction
What the projection is given for a view: yaw turns longitude, tilt tips latitude, zoom scales and pan moves the disc in CSS pixels.
Import it
import { projectionView } from "@johnmorrisdotca/chikyu-earth";
Definition
function projectionView(centre: GeoPoint, size: number, view?: GlobeView): ProjectionView
Parameters
| Name | Type | Description |
|---|---|---|
centre | GeoPoint | The home centre. |
size | number | The width and height of the square the globe is drawn in, in pixels. |
view (optional) | GlobeView | The turn, tip, zoom and pan; the home view when left out. |
Returns
ProjectionView
The rotation, scale and translation for d3-geo's orthographic projection.
Examples
import { projectionView } from "@johnmorrisdotca/chikyu-earth";
console.log(projectionView({ lon: 139.7, lat: 35.7 }, 420, { yaw: 10, tilt: 5, zoom: 2, panX: 0, panY: 0 }));{
rotation: [ -129.7, -30.700000000000003 ],
scale: 418,
translate: [ 210, 210 ]
}What it prints (run when this page was built)