googleMapsUrl (lib/external-map-links.ts)

GeoLibre · apps/geolibre-desktop/src/lib/external-map-links.ts · typescript · MIT
ui, tag:knn-classified

Builds URLs for Google Maps and Earth with coordinates and zoom.

// Source: https://github.com/opengeos/GeoLibre | License: MIT | Copyright 2026 Qiusheng Wu
// Provided via justclaw.it.com; keep this notice with the code.
// URL builders for "view this location in an external mapping site" actions
// (map context menu + View menu). Pure functions with no DOM or map access so
// they can be unit-tested in Node; call sites hand the result to
// `openExternalLink`.

/** Decimal places for coordinates in generated URLs (~0.1 m at the equator). */
const COORD_PRECISION = 6;

/** Zoom range Google Maps accepts in the `@lat,lng,{zoom}z` camera URL. */
const GOOGLE_MAPS_MIN_ZOOM = 2;
const GOOGLE_MAPS_MAX_ZOOM = 21;

/**
 * Scaling anchor for the zoom → Google Earth camera distance conversion, in
 * metres: the (theoretical) distance whose ~35° field of view sp

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key