Reference · The globe as an SVG string
readRoutefunction
Read the route attribute: lon,lat,lon,lat. Anything else is no route.
Import it
import { readRoute } from "@johnmorrisdotca/chikyu-earth";
Definition
function readRoute(value: string | null | undefined): { from: GeoPoint; to: GeoPoint; } | null
Parameters
| Name | Type | Description |
|---|---|---|
value | string | null | undefined | The attribute's text, or null. |
Returns
{ from: GeoPoint; to: GeoPoint; } | null
The two places, or null.
Examples
import { readRoute } from "@johnmorrisdotca/chikyu-earth";
console.log(readRoute("139.69,35.69,-0.13,51.51")?.from.lat);
console.log(readRoute("no"));35.69
nullWhat it prints (run when this page was built)