npm / geolib
geolib
What changed in geolib 4, from its official release notes, upgrade guides and advisories. Sources checked 2026-10-25.
12 breaking3 new APIs and options1 performance2 behavior and defaults5 fixes and other
See which of these apply to your code, ranked, in your agent:
npx @unstale/cli initgeolib 423 changes
Breaking changes 12
The browser build no longer supports AMD loaders.
The default radius is now 6,378,137 meters, moving results by about 0.1%; pass 6371000 as the fourth argument for previous results.
The default area unit is now square meters.
The browser build moved from
lib/index.jsto this file.The output targets ES2020, so very old browsers such as Internet Explorer are no longer supported.
There is no default export; use
import * as geolib from 'geolib'instead.Deep imports are gone; import named functions from the package root instead.
Deep imports are gone; import named functions from the package root instead.
The result is rounded to the given accuracy, 1 meter by default; pass an accuracy of 0 for the unrounded distance.
Polygon edges spanning more than 180 but less than 360 degrees of longitude are treated as crossing the antimeridian; add an intermediate vertex when an edge should go the long way around.
The type definitions require TypeScript 4.7 or newer.
Validators return false instead of throwing when given null.
New APIs and options 3
Adds a function for finding the intersection of lines.
Adds a function for checking whether a point is in a bounding box.
TypeScript types are now exported from the package entry.
Performance 1
Each distance is now calculated only once.
Behavior and default changes 2
The type of the points is preserved in the result.
The type of the points is preserved in the result.
Fixes and other changes 5
The function now uses the haversine formula as documented.
Point-in-line checks are now precise for long and short lines.
The comparison now uses the unrounded distance.
The comparison now uses the unrounded distance.
WKT polygons are parsed regardless of whitespace and parentheses.