# pointToLineDistance

Returns the minimum distance between a Point and a LineString , being the distance from a line the minimum distance between the point and any segment of the LineString.

> npm install @turf/point-to-line-distance


参数 类型 描述
pt Coord Feature or Geometry
line Feature <LineString> GeoJSON Feature or Geometry
options Object Optional parameters: see below


属性 类型 默认值 描述
units string kilometers can be degrees, radians, miles, or kilometers
mercator boolean false if distance should be on Mercator or WGS84 projection


number - distance between point and line


var pt = turf.point([0, 0]);
var line = turf.lineString([[1, 1],[-1, 1]]);

var distance = turf.pointToLineDistance(pt, line, {units: 'miles'});
Last Updated: 1/19/2021, 10:59:20 AM