geoprimsField-grade geospatial math

Add vertices along geodesic edges (densify)

Adds vertices along each edge of a line or polygon so no piece is longer than a set length, each on the true geodesic, so maps that draw straight segments still follow the Earth's curve.

9

The line now has 9 vertices, none more than 178.688 km apart.

Densified vertices
LatitudeLongitude
39.8561000 deg-104.6737000 deg
40.2522447 deg-102.6439138 deg
40.6123597 deg-100.5914119 deg
40.9356009 deg-98.5178976 deg
41.2211897 deg-96.4252630 deg
41.4684219 deg-94.3155787 deg
41.6766746 deg-92.1910802 deg
41.8454138 deg-90.0541506 deg
41.9742000 deg-87.9073000 deg
Vertices given
Longest piece
Total length
Provenance
Computed by
geometry.shape.densify 1.0.0, core 0.1.0
Model
Each edge's geodesic on WGS 84 (Karney inverse) is cut into n = ⌈length / longest piece⌉ equal pieces, with the new vertices placed by the direct problem
Accuracy
Every new vertex lies on its edge's geodesic to a nanometer; the pieces of an edge are equal to a nanometer
Notes
None
Cites
Karney, C. F. F., Journal of Geodesy, Algorithms for geodesics

Something look off?

Your values

Showing an example. Change anything.
KML, KMZ, GPX, GeoJSON, CSV, WKT, or WKB — or drop it on the box. Read on this device.
Run many at once from a CSV

Loading…

How we got thisFormula, worked example, sources, and proof

Model: Each edge's geodesic on WGS 84 (Karney inverse) is cut into n = ⌈length / longest piece⌉ equal pieces, with the new vertices placed by the direct problem

Show your work

  1. Longest piece

    each edge's length / ⌈length / longest piece⌉

    1 edges, 1,429.503 km in all = 178.688 km

  2. Vertices now

    the given vertices plus the pieces' new ends

    2 given = 9

The same steps an agent gets from the MCP server with explain: true.

Accuracy: Every new vertex lies on its edge's geodesic to a nanometer; the pieces of an edge are equal to a nanometer

When to use this: Use this before anything that treats a line as straight between its points. A route drawn on a map, a shape reprojected, a buffer or an overlay computed in a plane, a corridor checked against terrain: all of them chord the gaps, and over a long leg the chord can sit far from the geodesic the leg actually means. Adding vertices no further apart than a chosen distance brings the chords back onto the curve. It is also what makes two tracks sampled differently comparable, since a discrete Fréchet distance depends on how each was sampled.

Limitations: This adds vertices; it never moves or removes them, so the original points all survive and the result is longer to carry and slower to draw. It is the opposite of simplification, not a smoother: the shape is unchanged, only better described. The maximum length is a bound and pieces come out shorter, since an edge is divided into equal parts — an edge of 120 km at a 40 km maximum becomes three pieces of exactly 40 km, but one of 121 km becomes four of 30.25 km. There is a ceiling on how many vertices a result may have, and a very small maximum over a long route is refused rather than silently truncated.

Worked example: Denver to Chicago, in pieces of at most 200 km. Source: Karney (2013) inverse and direct on WGS 84. Checked against his own geographiclib over fifteen cases — lines, polygons, a meridian, the equator, the antimeridian and high latitudes — agreeing on every vertex count, on the lengths to 1.6e-13 relative, and placing the interior vertices within 2.1e-14 deg. It is golden test vector v001, and every build checks the tool still gives its answer within its tolerance.

You enter

Longest piece
200 km
Vertices
39.8561, -104.6737 41.9742, -87.9073

You get

Vertices now
9
Vertices given
2
Longest piece
178.688 km
Total length
1,429.503 km

Review: Not yet independently reviewed by a GIS professional.

Last verified: 2026-09-18, when a maintainer last confirmed this tool's sources at the issuer. See the sources ledger.

Status: version 1.0.0, core 0.1.0. See this tool in the verification report.

Checked against: 21 golden test vectors (download the test vectors, each with its source and tolerance). See how results are checked and every source.

Sources