{"name":"@turf/nearest-point-on-line","version":"7.1.0","description":"turf nearest-point-on-line module","author":"Turf Authors","license":"MIT","bugs":{"url":"https://github.com/Turfjs/turf/issues"},"homepage":"https://github.com/Turfjs/turf","repository":{"type":"git","url":"git://github.com/Turfjs/turf.git"},"funding":"https://opencollective.com/turf","publishConfig":{"access":"public"},"type":"module","main":"dist/cjs/index.cjs","module":"dist/esm/index.js","types":"dist/esm/index.d.ts","exports":{"./package.json":"./package.json",".":{"import":{"types":"./dist/esm/index.d.ts","default":"./dist/esm/index.js"},"require":{"types":"./dist/cjs/index.d.cts","default":"./dist/cjs/index.cjs"}}},"sideEffects":false,"scripts":{"bench":"tsx bench.ts","build":"tsup --config ../../tsup.config.ts","docs":"tsx ../../scripts/generate-readmes.ts","test":"npm-run-all --npm-path npm test:*","test:tape":"tsx test.ts","test:types":"tsc --esModuleInterop --module node16 --moduleResolution node16 --noEmit --strict types.ts"},"devDependencies":{"@turf/along":"^7.1.0","@turf/length":"^7.1.0","@turf/truncate":"^7.1.0","@types/benchmark":"^2.1.5","@types/tape":"^4.2.32","benchmark":"^2.1.4","load-json-file":"^7.0.1","npm-run-all":"^4.1.5","tape":"^5.7.2","tsup":"^8.0.1","tsx":"^4.6.2","typescript":"^5.2.2","write-json-file":"^5.0.0"},"dependencies":{"@turf/bearing":"^7.1.0","@turf/destination":"^7.1.0","@turf/distance":"^7.1.0","@turf/helpers":"^7.1.0","@turf/invariant":"^7.1.0","@turf/line-intersect":"^7.1.0","@turf/meta":"^7.1.0","@types/geojson":"^7946.0.10","tslib":"^2.6.2"},"gitHead":"68915eeebc9278bb40dec3f1034499698a0561ef","_nodeVersion":"18.20.4","_npmVersion":"lerna/8.1.7/node@v18.20.4+x64 (linux)","_id":"@turf/nearest-point-on-line@7.1.0","dist":{"integrity":"sha512-aTjAOm7ab0tl5JoxGYRx/J/IbRL1DY1ZCIYQDMEQjK5gOllhclgeBC0wDXDkEZFGaVftjw0W2RtE2I0jX7RG4A==","shasum":"002dce6723ff6a01bff4ed6168ee36f62cc66f41","tarball":"http://registry-npm.ywwl.com/@turf/nearest-point-on-line/download/@turf/nearest-point-on-line-7.1.0.tgz","fileCount":9,"unpackedSize":33648,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQC/pGrmUwFeQ+skScJXear9su2ljUFJiRXX4lrKKkyxcQIgCvC98J2LXBAwGri8yi6laJz51z6JVZxUtWF9ggy5zoY="}],"size":6276,"noattachment":false,"key":"/@turf/nearest-point-on-line/-/@turf/nearest-point-on-line-7.1.0.tgz"},"_npmUser":{"name":"mdfedderly","email":"mdfedderly@mdfedderly.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/nearest-point-on-line_7.1.0_1723227907890_0.36963625322782967"},"_hasShrinkwrap":false,"readme":"# @turf/nearest-point-on-line\n\n<!-- Generated by documentation.js. Update this documentation by updating the source code. -->\n\n## nearestPointOnLine\n\nReturns the nearest point on a line to a given point.\n\nIf any of the segments in the input line string are antipodal and therefore\nhave an undefined arc, this function will instead return that the point lies\non the line.\n\n⚠️ We have begun the process of migrating to different return properties for\nthis function. The new properties we recommend using as of v7.4 are:\n\n*   lineStringIndex - point was found on the nth LineString of an input MultiLineString. Previously `multiFeatureIndex`\n*   segmentIndex - point was found on the nth segment of the above LineString. Previously `index`\n*   totalDistance - distance from the start of the overall MultiLineString. Previously `location`\n*   lineDistance - distance from the start of the relevant LineString\n*   segmentDistance - distance from the start of the relevant segment\n*   pointDistance - distance between found point is from input reference point. Previously `dist`\n\nmultiFeatureIndex, index, location, and dist continue to work as previously\nuntil at least the next major release.\n\n### Parameters\n\n*   `lines` **([Geometry][1] | [Feature][2]<([LineString][3] | [MultiLineString][4])>)** Lines to snap to\n*   `inputPoint` **([Geometry][1] | [Feature][2]<[Point][5]> | [Array][6]<[number][7]>)** Point to snap from\n*   `options` **[Object][8]** Optional parameters (optional, default `{}`)\n\n    *   `options.units` **Units** Supports all valid Turf [Units][9] (optional, default `'kilometers'`)\n\n### Examples\n\n```javascript\nvar line = turf.lineString([\n    [-77.031669, 38.878605],\n    [-77.029609, 38.881946],\n    [-77.020339, 38.884084],\n    [-77.025661, 38.885821],\n    [-77.021884, 38.889563],\n    [-77.019824, 38.892368]\n]);\nvar inputPoint = turf.point([-77.037076, 38.884017]);\n\nvar snapped = turf.nearestPointOnLine(line, inputPoint, {units: 'miles'});\n\n//addToMap\nvar addToMap = [line, inputPoint, snapped];\nsnapped.properties['marker-color'] = '#00f';\n```\n\nReturns **[Feature][2]<[Point][5]>** closest point on the `lines` to the `inputPoint`. The point will have the following properties: `lineStringIndex`: closest point was found on the nth LineString (only relevant if input is MultiLineString), `segmentIndex`: closest point was found on nth line segment of the LineString, `totalDistance`: distance along the line from the absolute start of the MultiLineString, `lineDistance`: distance along the line from the start of the LineString where the closest point was found, `segmentDistance`: distance along the line from the start of the line segment where the closest point was found, `pointDistance`: distance to the input point.\n\n[1]: https://tools.ietf.org/html/rfc7946#section-3.1\n\n[2]: https://tools.ietf.org/html/rfc7946#section-3.2\n\n[3]: https://tools.ietf.org/html/rfc7946#section-3.1.4\n\n[4]: https://tools.ietf.org/html/rfc7946#section-3.1.5\n\n[5]: https://tools.ietf.org/html/rfc7946#section-3.1.2\n\n[6]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array\n\n[7]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number\n\n[8]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object\n\n[9]: https://turfjs.org/docs/api/types/Units\n\n<!-- This file is automatically generated. Please don't edit it directly. If you find an error, edit the source file of the module in question (likely index.js or index.ts), and re-run \"yarn docs\" from the root of the turf project. -->\n\n---\n\nThis module is part of the [Turfjs project](https://turfjs.org/), an open source module collection dedicated to geographic algorithms. It is maintained in the [Turfjs/turf](https://github.com/Turfjs/turf) repository, where you can create PRs and issues.\n\n### Installation\n\nInstall this single module individually:\n\n```sh\n$ npm install @turf/nearest-point-on-line\n```\n\nOr install the all-encompassing @turf/turf module that includes all modules as functions:\n\n```sh\n$ npm install @turf/turf\n```\n","publish_time":1723227908104,"maintainers":[{"name":"smallsaucepan","email":"james@smallsaucepan.com"},{"name":"morgan.herlocker","email":"morganherlocker@gmail.com"},{"name":"twelch","email":"tim.j.welch@gmail.com"},{"name":"jamesmilneruk","email":"jamesmilner22@hotmail.com"},{"name":"rowanwins","email":"rowanwins@yahoo.com.au"},{"name":"tmcw","email":"tom@macwright.com"},{"name":"morganherlocker","email":"morgan.herlocker@gmail.com"},{"name":"tcql","email":"tim.channell@gmail.com"},{"name":"mdfedderly","email":"mdfedderly@mdfedderly.com"}],"_cnpm_publish_time":1723227908104,"dist-tags":{"latest":"7.4.0","prerelease":"7.1.0-alpha.70"}}