@turf/along 7.0.0 → 7.1.0-alpha.70
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -12
- package/dist/cjs/index.cjs +1 -5
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/esm/index.js +0 -4
- package/dist/esm/index.js.map +1 -1
- package/package.json +8 -7
package/README.md
CHANGED
|
@@ -8,11 +8,11 @@ Takes a [LineString][1] and returns a [Point][2] at a specified distance along t
|
|
|
8
8
|
|
|
9
9
|
### Parameters
|
|
10
10
|
|
|
11
|
-
* `line` **[Feature][3]<[LineString][
|
|
12
|
-
* `distance` **[number][
|
|
13
|
-
* `options` **[Object][
|
|
11
|
+
* `line` **[Feature][3]<[LineString][1]>** input line
|
|
12
|
+
* `distance` **[number][4]** distance along the line
|
|
13
|
+
* `options` **[Object][5]?** Optional parameters
|
|
14
14
|
|
|
15
|
-
* `options.units` **[string][
|
|
15
|
+
* `options.units` **[string][6]** can be degrees, radians, miles, or kilometers (optional, default `"kilometers"`)
|
|
16
16
|
|
|
17
17
|
### Examples
|
|
18
18
|
|
|
@@ -26,7 +26,7 @@ var along = turf.along(line, 200, options);
|
|
|
26
26
|
var addToMap = [along, line]
|
|
27
27
|
```
|
|
28
28
|
|
|
29
|
-
Returns **[Feature][3]<[Point][
|
|
29
|
+
Returns **[Feature][3]<[Point][2]>** Point `distance` `units` along the line
|
|
30
30
|
|
|
31
31
|
[1]: https://tools.ietf.org/html/rfc7946#section-3.1.4
|
|
32
32
|
|
|
@@ -34,15 +34,11 @@ Returns **[Feature][3]<[Point][8]>** Point `distance` `units` along the line
|
|
|
34
34
|
|
|
35
35
|
[3]: https://tools.ietf.org/html/rfc7946#section-3.2
|
|
36
36
|
|
|
37
|
-
[4]: https://
|
|
37
|
+
[4]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number
|
|
38
38
|
|
|
39
|
-
[5]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/
|
|
39
|
+
[5]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object
|
|
40
40
|
|
|
41
|
-
[6]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/
|
|
42
|
-
|
|
43
|
-
[7]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String
|
|
44
|
-
|
|
45
|
-
[8]: https://tools.ietf.org/html/rfc7946#section-3.1.2
|
|
41
|
+
[6]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String
|
|
46
42
|
|
|
47
43
|
<!-- 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. -->
|
|
48
44
|
|
package/dist/cjs/index.cjs
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true})
|
|
2
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
-
|
|
4
|
-
// index.ts
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});// index.ts
|
|
5
2
|
var _bearing = require('@turf/bearing');
|
|
6
3
|
var _destination = require('@turf/destination');
|
|
7
4
|
var _distance = require('@turf/distance');
|
|
@@ -34,7 +31,6 @@ function along(line, distance, options = {}) {
|
|
|
34
31
|
}
|
|
35
32
|
return _helpers.point.call(void 0, coords[coords.length - 1]);
|
|
36
33
|
}
|
|
37
|
-
__name(along, "along");
|
|
38
34
|
var turf_along_default = along;
|
|
39
35
|
|
|
40
36
|
|
package/dist/cjs/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../index.ts"],"names":[],"mappings":";AACA,SAAS,eAAe;AACxB,SAAS,mBAAmB;AAC5B,SAAS,YAAY,uBAAuB;AAC5C,SAAS,aAAoB;AAC7B,SAAS,eAAe;AAoBxB,SAAS,MACP,MACA,UACA,UAA6B,CAAC,GACd;AAEhB,QAAM,OAAO,QAAQ,IAAI;AACzB,QAAM,SAAS,KAAK;AACpB,MAAI,YAAY;AAChB,WAAS,IAAI,GAAG,IAAI,OAAO,QAAQ,KAAK;AACtC,QAAI,YAAY,aAAa,MAAM,OAAO,SAAS,GAAG;AACpD;AAAA,IACF,WAAW,aAAa,UAAU;AAChC,YAAM,WAAW,WAAW;AAC5B,UAAI,CAAC,UAAU;AACb,eAAO,MAAM,OAAO,CAAC,CAAC;AAAA,MACxB,OAAO;AACL,cAAM,YAAY,QAAQ,OAAO,CAAC,GAAG,OAAO,IAAI,CAAC,CAAC,IAAI;AACtD,cAAM,eAAe;AAAA,UACnB,OAAO,CAAC;AAAA,UACR;AAAA,UACA;AAAA,UACA;AAAA,QACF;AACA,eAAO;AAAA,MACT;AAAA,IACF,OAAO;AACL,mBAAa,gBAAgB,OAAO,CAAC,GAAG,OAAO,IAAI,CAAC,GAAG,OAAO;AAAA,IAChE;AAAA,EACF;AACA,SAAO,MAAM,OAAO,OAAO,SAAS,CAAC,CAAC;AACxC;AAGA,IAAO,qBAAQ","sourcesContent":["import { Feature, LineString, Point } from \"geojson\";\nimport { bearing } from \"@turf/bearing\";\nimport { destination } from \"@turf/destination\";\nimport { distance as measureDistance } from \"@turf/distance\";\nimport { point, Units } from \"@turf/helpers\";\nimport { getGeom } from \"@turf/invariant\";\n\n/**\n * Takes a {@link LineString} and returns a {@link Point} at a specified distance along the line.\n *\n * @name along\n * @param {Feature<LineString>} line input line\n * @param {number} distance distance along the line\n * @param {Object} [options] Optional parameters\n * @param {string} [options.units=\"kilometers\"] can be degrees, radians, miles, or kilometers\n * @returns {Feature<Point>} Point `distance` `units` along the line\n * @example\n * var line = turf.lineString([[-83, 30], [-84, 36], [-78, 41]]);\n * var options = {units: 'miles'};\n *\n * var along = turf.along(line, 200, options);\n *\n * //addToMap\n * var addToMap = [along, line]\n */\nfunction along(\n line: Feature<LineString> | LineString,\n distance: number,\n options: { units?: Units } = {}\n): Feature<Point> {\n // Get Coords\n const geom = getGeom(line);\n const coords = geom.coordinates;\n let travelled = 0;\n for (let i = 0; i < coords.length; i++) {\n if (distance >= travelled && i === coords.length - 1) {\n break;\n } else if (travelled >= distance) {\n const overshot = distance - travelled;\n if (!overshot) {\n return point(coords[i]);\n } else {\n const direction = bearing(coords[i], coords[i - 1]) - 180;\n const interpolated = destination(\n coords[i],\n overshot,\n direction,\n options\n );\n return interpolated;\n }\n } else {\n travelled += measureDistance(coords[i], coords[i + 1], options);\n }\n }\n return point(coords[coords.length - 1]);\n}\n\nexport { along };\nexport default along;\n"]}
|
package/dist/esm/index.js
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
-
|
|
4
1
|
// index.ts
|
|
5
2
|
import { bearing } from "@turf/bearing";
|
|
6
3
|
import { destination } from "@turf/destination";
|
|
@@ -34,7 +31,6 @@ function along(line, distance, options = {}) {
|
|
|
34
31
|
}
|
|
35
32
|
return point(coords[coords.length - 1]);
|
|
36
33
|
}
|
|
37
|
-
__name(along, "along");
|
|
38
34
|
var turf_along_default = along;
|
|
39
35
|
export {
|
|
40
36
|
along,
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../index.ts"],"sourcesContent":["import { Feature, LineString, Point } from \"geojson\";\nimport { bearing } from \"@turf/bearing\";\nimport { destination } from \"@turf/destination\";\nimport { distance as measureDistance } from \"@turf/distance\";\nimport { point, Units } from \"@turf/helpers\";\nimport { getGeom } from \"@turf/invariant\";\n\n/**\n * Takes a {@link LineString} and returns a {@link Point} at a specified distance along the line.\n *\n * @name along\n * @param {Feature<LineString>} line input line\n * @param {number} distance distance along the line\n * @param {Object} [options] Optional parameters\n * @param {string} [options.units=\"kilometers\"] can be degrees, radians, miles, or kilometers\n * @returns {Feature<Point>} Point `distance` `units` along the line\n * @example\n * var line = turf.lineString([[-83, 30], [-84, 36], [-78, 41]]);\n * var options = {units: 'miles'};\n *\n * var along = turf.along(line, 200, options);\n *\n * //addToMap\n * var addToMap = [along, line]\n */\nfunction along(\n line: Feature<LineString> | LineString,\n distance: number,\n options: { units?: Units } = {}\n): Feature<Point> {\n // Get Coords\n const geom = getGeom(line);\n const coords = geom.coordinates;\n let travelled = 0;\n for (let i = 0; i < coords.length; i++) {\n if (distance >= travelled && i === coords.length - 1) {\n break;\n } else if (travelled >= distance) {\n const overshot = distance - travelled;\n if (!overshot) {\n return point(coords[i]);\n } else {\n const direction = bearing(coords[i], coords[i - 1]) - 180;\n const interpolated = destination(\n coords[i],\n overshot,\n direction,\n options\n );\n return interpolated;\n }\n } else {\n travelled += measureDistance(coords[i], coords[i + 1], options);\n }\n }\n return point(coords[coords.length - 1]);\n}\n\nexport { along };\nexport default along;\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../index.ts"],"sourcesContent":["import { Feature, LineString, Point } from \"geojson\";\nimport { bearing } from \"@turf/bearing\";\nimport { destination } from \"@turf/destination\";\nimport { distance as measureDistance } from \"@turf/distance\";\nimport { point, Units } from \"@turf/helpers\";\nimport { getGeom } from \"@turf/invariant\";\n\n/**\n * Takes a {@link LineString} and returns a {@link Point} at a specified distance along the line.\n *\n * @name along\n * @param {Feature<LineString>} line input line\n * @param {number} distance distance along the line\n * @param {Object} [options] Optional parameters\n * @param {string} [options.units=\"kilometers\"] can be degrees, radians, miles, or kilometers\n * @returns {Feature<Point>} Point `distance` `units` along the line\n * @example\n * var line = turf.lineString([[-83, 30], [-84, 36], [-78, 41]]);\n * var options = {units: 'miles'};\n *\n * var along = turf.along(line, 200, options);\n *\n * //addToMap\n * var addToMap = [along, line]\n */\nfunction along(\n line: Feature<LineString> | LineString,\n distance: number,\n options: { units?: Units } = {}\n): Feature<Point> {\n // Get Coords\n const geom = getGeom(line);\n const coords = geom.coordinates;\n let travelled = 0;\n for (let i = 0; i < coords.length; i++) {\n if (distance >= travelled && i === coords.length - 1) {\n break;\n } else if (travelled >= distance) {\n const overshot = distance - travelled;\n if (!overshot) {\n return point(coords[i]);\n } else {\n const direction = bearing(coords[i], coords[i - 1]) - 180;\n const interpolated = destination(\n coords[i],\n overshot,\n direction,\n options\n );\n return interpolated;\n }\n } else {\n travelled += measureDistance(coords[i], coords[i + 1], options);\n }\n }\n return point(coords[coords.length - 1]);\n}\n\nexport { along };\nexport default along;\n"],"mappings":";AACA,SAAS,eAAe;AACxB,SAAS,mBAAmB;AAC5B,SAAS,YAAY,uBAAuB;AAC5C,SAAS,aAAoB;AAC7B,SAAS,eAAe;AAoBxB,SAAS,MACP,MACA,UACA,UAA6B,CAAC,GACd;AAEhB,QAAM,OAAO,QAAQ,IAAI;AACzB,QAAM,SAAS,KAAK;AACpB,MAAI,YAAY;AAChB,WAAS,IAAI,GAAG,IAAI,OAAO,QAAQ,KAAK;AACtC,QAAI,YAAY,aAAa,MAAM,OAAO,SAAS,GAAG;AACpD;AAAA,IACF,WAAW,aAAa,UAAU;AAChC,YAAM,WAAW,WAAW;AAC5B,UAAI,CAAC,UAAU;AACb,eAAO,MAAM,OAAO,CAAC,CAAC;AAAA,MACxB,OAAO;AACL,cAAM,YAAY,QAAQ,OAAO,CAAC,GAAG,OAAO,IAAI,CAAC,CAAC,IAAI;AACtD,cAAM,eAAe;AAAA,UACnB,OAAO,CAAC;AAAA,UACR;AAAA,UACA;AAAA,UACA;AAAA,QACF;AACA,eAAO;AAAA,MACT;AAAA,IACF,OAAO;AACL,mBAAa,gBAAgB,OAAO,CAAC,GAAG,OAAO,IAAI,CAAC,GAAG,OAAO;AAAA,IAChE;AAAA,EACF;AACA,SAAO,MAAM,OAAO,OAAO,SAAS,CAAC,CAAC;AACxC;AAGA,IAAO,qBAAQ;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@turf/along",
|
|
3
|
-
"version": "7.0.
|
|
3
|
+
"version": "7.1.0-alpha.70+948cdafaf",
|
|
4
4
|
"description": "turf along module",
|
|
5
5
|
"author": "Turf Authors",
|
|
6
6
|
"license": "MIT",
|
|
@@ -63,12 +63,13 @@
|
|
|
63
63
|
"typescript": "^5.2.2"
|
|
64
64
|
},
|
|
65
65
|
"dependencies": {
|
|
66
|
-
"@turf/bearing": "^7.0.
|
|
67
|
-
"@turf/destination": "^7.0.
|
|
68
|
-
"@turf/distance": "^7.0.
|
|
69
|
-
"@turf/helpers": "^7.0.
|
|
70
|
-
"@turf/invariant": "^7.0.
|
|
66
|
+
"@turf/bearing": "^7.1.0-alpha.70+948cdafaf",
|
|
67
|
+
"@turf/destination": "^7.1.0-alpha.70+948cdafaf",
|
|
68
|
+
"@turf/distance": "^7.1.0-alpha.70+948cdafaf",
|
|
69
|
+
"@turf/helpers": "^7.1.0-alpha.70+948cdafaf",
|
|
70
|
+
"@turf/invariant": "^7.1.0-alpha.70+948cdafaf",
|
|
71
|
+
"@types/geojson": "^7946.0.10",
|
|
71
72
|
"tslib": "^2.6.2"
|
|
72
73
|
},
|
|
73
|
-
"gitHead": "
|
|
74
|
+
"gitHead": "948cdafaf70606d2e27fcc79973fa48ee1182067"
|
|
74
75
|
}
|