{"name":"@turf/nearest-point-on-line","version":"7.3.4","author":{"name":"Turf Authors"},"license":"MIT","_id":"@turf/nearest-point-on-line@7.3.4","maintainers":[{"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"},{"name":"twelch","email":"tim.j.welch@gmail.com"},{"name":"jamesmilneruk","email":"jamesmilner22@hotmail.com"},{"name":"morgan.herlocker","email":"morganherlocker@gmail.com"},{"name":"smallsaucepan","email":"james@smallsaucepan.com"}],"contributors":[{"name":"Angel Lacret","email":"@alacret"},{"name":"Emil Junker","email":"@EmilJunker"},{"name":"Jon Miles","email":"@jonmiles"},{"name":"John Ziebro","email":"@Insighttful"}],"homepage":"https://github.com/Turfjs/turf","bugs":{"url":"https://github.com/Turfjs/turf/issues"},"dist":{"shasum":"0e6ef812a0deacb0aee15fb924b1246027cd0f61","tarball":"http://registry-npm.ywwl.com/@turf/nearest-point-on-line/download/@turf/nearest-point-on-line-7.3.4.tgz","fileCount":9,"integrity":"sha512-DQrP3lRju83rIXFN68tUEpc7ki/eRwdwBkK2CTT4RAcyCxbcH2NGJPQv8dYiww/Ar77u1WLVn+aINXZH904dWw==","signatures":[{"sig":"MEUCIQDP6Eh88EZBvoECqhiN6g9IhKL1uWgccmj09EREm9SYPQIgPsceVP8yv/FT9AJYve5dZlaAFxZnOqIG4Lf0abBgQpQ=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@turf%2fnearest-point-on-line@7.3.4","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":64473,"size":11895,"noattachment":false,"key":"/@turf/nearest-point-on-line/-/@turf/nearest-point-on-line-7.3.4.tgz"},"main":"dist/cjs/index.cjs","type":"module","types":"dist/esm/index.d.ts","module":"dist/esm/index.js","exports":{".":{"import":{"types":"./dist/esm/index.d.ts","default":"./dist/esm/index.js"},"require":{"types":"./dist/cjs/index.d.cts","default":"./dist/cjs/index.cjs"}},"./package.json":"./package.json"},"funding":"https://opencollective.com/turf","gitHead":"a0878648b801443f342aae692c60ab95a1da61a9","scripts":{"docs":"tsx ../../scripts/generate-readmes.ts","test":"pnpm run /test:.*/","bench":"tsx bench.ts","build":"tsup --config ../../tsup.config.ts","test:tape":"tsx test.ts","test:types":"tsc --esModuleInterop --module node16 --moduleResolution node16 --noEmit --strict types.ts"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:5255d933-c9c6-461d-b411-6d661a715be8"}},"repository":{"url":"git://github.com/Turfjs/turf.git","type":"git"},"_npmVersion":"lerna/9.0.3/node@v20.20.0+x64 (linux)","description":"Finds the nearest point on a line to a given point","directories":{},"sideEffects":false,"_nodeVersion":"20.20.0","dependencies":{"tslib":"^2.8.1","@turf/meta":"7.3.4","@turf/helpers":"7.3.4","@turf/distance":"7.3.4","@types/geojson":"^7946.0.10","@turf/invariant":"7.3.4"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.19.4","tape":"^5.9.0","tsup":"^8.4.0","benchmark":"^2.1.4","typescript":"^5.8.3","@turf/along":"7.3.4","@types/tape":"^5.8.1","@turf/length":"7.3.4","@turf/truncate":"7.3.4","load-json-file":"^7.0.1","write-json-file":"^6.0.0","@types/benchmark":"^2.1.5"},"_npmOperationalInternal":{"tmp":"tmp/nearest-point-on-line_7.3.4_1770516193134_0.6762893023936909","host":"s3://npm-registry-packages-npm-production"},"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":1770516193283,"_cnpm_publish_time":1770516193283,"dist-tags":{"latest":"7.4.0","prerelease":"7.1.0-alpha.70"}}