How Length Calculation Works
This tool measures the geodesic length of LineString and MultiLineString features in your GeoJSON. It calculates the true distance along the Earth's surface using the WGS 84 ellipsoid, accounting for the curvature of the Earth. Results are shown in meters, kilometers, and miles.
For FeatureCollections containing multiple LineStrings, the tool reports the total combined length. Polygon perimeters are also measured if no LineString features are present. The measurement walks each segment between consecutive coordinates, summing the geodesic distance for each pair using Turf.js's length function.
Geodesic vs. Planar Distance
Geodesic distance follows the curvature of the Earth, giving accurate results for any scale. Planar distance treats coordinates as flat x/y values, which introduces significant errors for features that span large distances. This tool always uses geodesic measurement.
For short distances (under a few kilometers), the difference is negligible. For cross-country routes or ocean paths, the geodesic calculation can differ from planar by several percent. A New York to London flight path measured with planar math would be off by hundreds of kilometers compared to the true great-circle distance.
Understanding the Results
The tool reports length in three units simultaneously:
- Meters — the base SI unit, best for short distances like trails, building perimeters, and city blocks
- Kilometers — standard for road distances, hiking routes, and infrastructure planning
- Miles — commonly used in the United States and United Kingdom for road and travel distances
If you need other units such as nautical miles or feet, convert from the meter value. One nautical mile equals 1,852 meters. One foot equals 0.3048 meters.
Common Use Cases
- Measuring road or trail distances from route GeoJSON
- Calculating river or coastline lengths
- Estimating pipeline or cable run distances
- Verifying distances from routing API responses
- Computing total border length between adjacent regions
- Checking GPS track accuracy by comparing recorded vs. expected distances
Programmatic Equivalent
In JavaScript with Turf.js:
JavaScriptconst km = turf.length(lineFeature, { units: 'kilometers' });
const miles = turf.length(lineFeature, { units: 'miles' });In Python with Shapely and pyproj:
Pythonfrom shapely.geometry import shape
from pyproj import Geod
geod = Geod(ellps="WGS84")
line = shape(geojson_geometry)
length_m = geod.geometry_length(line)To measure area instead of length, use the area calculator. To find the center point of a line, try the centroid calculator.