map.applyGeoLayout
applyGeoLayout(options: ApplyGeoLayoutOptions): ApplyGeoLayoutResultPlace geo nodes on the map without swapping the position provider.
Writes each geo node's world position into the live
store.positionProvider buffer in place, then pins those nodes so the
force layout leaves them anchored at lat/lng.
Non-geo nodes are not touched. They keep participating in force layout — so they can be dragged, drift toward geo neighbors via edge forces, and (importantly) newly added nodes get force-layout positions naturally instead of landing at the origin. Picker, drag, selection all keep reading from the same live provider the renderer reads, so they all stay correct.
Idempotent. Re-call to change mode (planar ↔ spherical) — the new
geo positions overwrite the buffer; store.pinNodes no-ops on already
pinned nodes.
Pair with releaseGeoLayout (or store.unpinNodes(...)) on
Hide Map so the force layout can move those nodes again.
Spherical math uses polar2Cartesian and planar uses SlippyMapFlat,
matching the engine's globe / flat-map surface.
options | ApplyGeoLayoutOptions |
Returns: ApplyGeoLayoutResult
Example
// On Show Map:
const { geoNodeIds } = api.map.applyGeoLayout({ mode: "spherical" });
pinnedRef.current = geoNodeIds;
// On Hide Map:
api.map.releaseGeoLayout(pinnedRef.current);