@turf/shortest-path 6.5.0 → 7.0.0-alpha.1
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 +11 -10
- package/dist/es/index.js +0 -0
- package/dist/js/index.js +0 -0
- package/index.d.ts +2 -8
- package/package.json +18 -16
package/README.md
CHANGED
|
@@ -7,17 +7,18 @@
|
|
|
7
7
|
Returns the shortest [path][1] from [start][2] to [end][2] without colliding with
|
|
8
8
|
any [Feature][3] in [ obstacles][4]
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
### Parameters
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
- `options.obstacles` **([Geometry][7] \| [Feature][8] \| [FeatureCollection][9]<[Polygon][10]>)?** areas which path cannot travel
|
|
16
|
-
- `options.minDistance` **[number][11]?** minimum distance between shortest path and obstacles
|
|
17
|
-
- `options.units` **[string][12]** unit in which resolution & minimum distance will be expressed in; it can be degrees, radians, miles, kilometers, ... (optional, default `'kilometers'`)
|
|
18
|
-
- `options.resolution` **[number][11]** distance between matrix points on which the path will be calculated (optional, default `100`)
|
|
12
|
+
* `start` **[Coord][5]** point
|
|
13
|
+
* `end` **[Coord][5]** point
|
|
14
|
+
* `options` **[Object][6]** optional parameters (optional, default `{}`)
|
|
19
15
|
|
|
20
|
-
**
|
|
16
|
+
* `options.obstacles` **([Geometry][7] | [Feature][8] | [FeatureCollection][9]<[Polygon][10]>)?** areas which path cannot travel
|
|
17
|
+
* `options.minDistance` **[number][11]?** minimum distance between shortest path and obstacles
|
|
18
|
+
* `options.units` **[string][12]** unit in which resolution & minimum distance will be expressed in; it can be degrees, radians, miles, kilometers, ... (optional, default `'kilometers'`)
|
|
19
|
+
* `options.resolution` **[number][11]** distance between matrix points on which the path will be calculated (optional, default `100`)
|
|
20
|
+
|
|
21
|
+
### Examples
|
|
21
22
|
|
|
22
23
|
```javascript
|
|
23
24
|
var start = [-5, -6];
|
|
@@ -32,7 +33,7 @@ var path = turf.shortestPath(start, end, options);
|
|
|
32
33
|
var addToMap = [start, end, options.obstacles, path];
|
|
33
34
|
```
|
|
34
35
|
|
|
35
|
-
Returns **[Feature][8]
|
|
36
|
+
Returns **[Feature][8]<[LineString][13]>** shortest path between start and end
|
|
36
37
|
|
|
37
38
|
[1]: https://tools.ietf.org/html/rfc7946#section-3.1.4
|
|
38
39
|
|
package/dist/es/index.js
CHANGED
|
File without changes
|
package/dist/js/index.js
CHANGED
|
File without changes
|
package/index.d.ts
CHANGED
|
@@ -1,11 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
Feature,
|
|
4
|
-
FeatureCollection,
|
|
5
|
-
Coord,
|
|
6
|
-
LineString,
|
|
7
|
-
Units,
|
|
8
|
-
} from "@turf/helpers";
|
|
1
|
+
import { Polygon, Feature, FeatureCollection, LineString } from "geojson";
|
|
2
|
+
import { Coord, Units } from "@turf/helpers";
|
|
9
3
|
|
|
10
4
|
/**
|
|
11
5
|
* http://turfjs.org/docs/#shortestpath
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@turf/shortest-path",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "7.0.0-alpha.1",
|
|
4
4
|
"description": "turf shortest-path module",
|
|
5
5
|
"author": "Turf Authors",
|
|
6
6
|
"contributors": [
|
|
@@ -30,6 +30,7 @@
|
|
|
30
30
|
"exports": {
|
|
31
31
|
"./package.json": "./package.json",
|
|
32
32
|
".": {
|
|
33
|
+
"types": "./index.d.ts",
|
|
33
34
|
"import": "./dist/es/index.js",
|
|
34
35
|
"require": "./dist/js/index.js"
|
|
35
36
|
}
|
|
@@ -41,32 +42,33 @@
|
|
|
41
42
|
"index.d.ts"
|
|
42
43
|
],
|
|
43
44
|
"scripts": {
|
|
44
|
-
"bench": "
|
|
45
|
+
"bench": "tsx bench.js",
|
|
45
46
|
"build": "rollup -c ../../rollup.config.js && echo '{\"type\":\"module\"}' > dist/es/package.json",
|
|
46
|
-
"docs": "
|
|
47
|
+
"docs": "tsx ../../scripts/generate-readmes",
|
|
47
48
|
"test": "npm-run-all test:*",
|
|
48
|
-
"test:tape": "
|
|
49
|
-
"test:types": "tsc --esModuleInterop --noEmit types.ts"
|
|
49
|
+
"test:tape": "tsx test.js",
|
|
50
|
+
"test:types": "tsc --esModuleInterop --noEmit --strict types.ts"
|
|
50
51
|
},
|
|
51
52
|
"devDependencies": {
|
|
52
|
-
"@turf/truncate": "^
|
|
53
|
+
"@turf/truncate": "^7.0.0-alpha.1",
|
|
53
54
|
"benchmark": "*",
|
|
54
55
|
"load-json-file": "*",
|
|
55
56
|
"npm-run-all": "*",
|
|
56
57
|
"rollup": "*",
|
|
57
58
|
"tape": "*",
|
|
59
|
+
"tsx": "*",
|
|
58
60
|
"write-json-file": "*"
|
|
59
61
|
},
|
|
60
62
|
"dependencies": {
|
|
61
|
-
"@turf/bbox": "^
|
|
62
|
-
"@turf/bbox-polygon": "^
|
|
63
|
-
"@turf/boolean-point-in-polygon": "^
|
|
64
|
-
"@turf/clean-coords": "^
|
|
65
|
-
"@turf/distance": "^
|
|
66
|
-
"@turf/helpers": "^
|
|
67
|
-
"@turf/invariant": "^
|
|
68
|
-
"@turf/meta": "^
|
|
69
|
-
"@turf/transform-scale": "^
|
|
63
|
+
"@turf/bbox": "^7.0.0-alpha.1",
|
|
64
|
+
"@turf/bbox-polygon": "^7.0.0-alpha.1",
|
|
65
|
+
"@turf/boolean-point-in-polygon": "^7.0.0-alpha.1",
|
|
66
|
+
"@turf/clean-coords": "^7.0.0-alpha.1",
|
|
67
|
+
"@turf/distance": "^7.0.0-alpha.1",
|
|
68
|
+
"@turf/helpers": "^7.0.0-alpha.1",
|
|
69
|
+
"@turf/invariant": "^7.0.0-alpha.1",
|
|
70
|
+
"@turf/meta": "^7.0.0-alpha.1",
|
|
71
|
+
"@turf/transform-scale": "^7.0.0-alpha.1"
|
|
70
72
|
},
|
|
71
|
-
"gitHead": "
|
|
73
|
+
"gitHead": "cf7a0c507b017ca066acffd0ce23bda5b393fb5a"
|
|
72
74
|
}
|