@turf/transform-translate 6.4.0 → 7.0.0-alpha.0
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 +10 -9
- package/dist/es/index.js +0 -0
- package/dist/js/index.js +10 -6
- package/package.json +10 -9
package/README.md
CHANGED
|
@@ -7,17 +7,18 @@
|
|
|
7
7
|
Moves any geojson Feature or Geometry of a specified distance along a Rhumb Line
|
|
8
8
|
on the provided direction angle.
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
### Parameters
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
- `options.units` **[string][4]** in which `distance` will be express; miles, kilometers, degrees, or radians (optional, default `'kilometers'`)
|
|
17
|
-
- `options.zTranslation` **[number][2]** length of the vertical motion, same unit of distance (optional, default `0`)
|
|
18
|
-
- `options.mutate` **[boolean][5]** allows GeoJSON input to be mutated (significant performance increase if true) (optional, default `false`)
|
|
12
|
+
* `geojson` **[GeoJSON][1]** object to be translated
|
|
13
|
+
* `distance` **[number][2]** length of the motion; negative values determine motion in opposite direction
|
|
14
|
+
* `direction` **[number][2]** of the motion; angle from North in decimal degrees, positive clockwise
|
|
15
|
+
* `options` **[Object][3]** Optional parameters (optional, default `{}`)
|
|
19
16
|
|
|
20
|
-
**
|
|
17
|
+
* `options.units` **[string][4]** in which `distance` will be express; miles, kilometers, degrees, or radians (optional, default `'kilometers'`)
|
|
18
|
+
* `options.zTranslation` **[number][2]** length of the vertical motion, same unit of distance (optional, default `0`)
|
|
19
|
+
* `options.mutate` **[boolean][5]** allows GeoJSON input to be mutated (significant performance increase if true) (optional, default `false`)
|
|
20
|
+
|
|
21
|
+
### Examples
|
|
21
22
|
|
|
22
23
|
```javascript
|
|
23
24
|
var poly = turf.polygon([[[0,29],[3.5,29],[2.5,32],[0,29]]]);
|
package/dist/es/index.js
CHANGED
|
File without changes
|
package/dist/js/index.js
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
|
|
4
|
-
|
|
5
3
|
var meta = require('@turf/meta');
|
|
6
4
|
var helpers = require('@turf/helpers');
|
|
7
5
|
var invariant = require('@turf/invariant');
|
|
8
|
-
var clone =
|
|
9
|
-
var rhumbDestination =
|
|
6
|
+
var clone = require('@turf/clone');
|
|
7
|
+
var rhumbDestination = require('@turf/rhumb-destination');
|
|
8
|
+
|
|
9
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
10
|
+
|
|
11
|
+
var clone__default = /*#__PURE__*/_interopDefaultLegacy(clone);
|
|
12
|
+
var rhumbDestination__default = /*#__PURE__*/_interopDefaultLegacy(rhumbDestination);
|
|
10
13
|
|
|
11
14
|
/**
|
|
12
15
|
* Moves any geojson Feature or Geometry of a specified distance along a Rhumb Line
|
|
@@ -58,12 +61,12 @@ function transformTranslate(geojson, distance, direction, options) {
|
|
|
58
61
|
}
|
|
59
62
|
|
|
60
63
|
// Clone geojson to avoid side effects
|
|
61
|
-
if (mutate === false || mutate === undefined) geojson =
|
|
64
|
+
if (mutate === false || mutate === undefined) geojson = clone__default['default'](geojson);
|
|
62
65
|
|
|
63
66
|
// Translate each coordinate
|
|
64
67
|
meta.coordEach(geojson, function (pointCoords) {
|
|
65
68
|
var newCoords = invariant.getCoords(
|
|
66
|
-
|
|
69
|
+
rhumbDestination__default['default'](pointCoords, distance, direction, { units: units })
|
|
67
70
|
);
|
|
68
71
|
pointCoords[0] = newCoords[0];
|
|
69
72
|
pointCoords[1] = newCoords[1];
|
|
@@ -74,3 +77,4 @@ function transformTranslate(geojson, distance, direction, options) {
|
|
|
74
77
|
}
|
|
75
78
|
|
|
76
79
|
module.exports = transformTranslate;
|
|
80
|
+
module.exports.default = transformTranslate;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@turf/transform-translate",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "7.0.0-alpha.0",
|
|
4
4
|
"description": "turf transform-translate module",
|
|
5
5
|
"author": "Turf Authors",
|
|
6
6
|
"contributors": [
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
"type": "git",
|
|
17
17
|
"url": "git://github.com/Turfjs/turf.git"
|
|
18
18
|
},
|
|
19
|
+
"funding": "https://opencollective.com/turf",
|
|
19
20
|
"publishConfig": {
|
|
20
21
|
"access": "public"
|
|
21
22
|
},
|
|
@@ -48,10 +49,10 @@
|
|
|
48
49
|
"docs": "node ../../scripts/generate-readmes",
|
|
49
50
|
"test": "npm-run-all test:*",
|
|
50
51
|
"test:tape": "node -r esm test.js",
|
|
51
|
-
"test:types": "tsc --esModuleInterop --noEmit types.ts"
|
|
52
|
+
"test:types": "tsc --esModuleInterop --noEmit --strict types.ts"
|
|
52
53
|
},
|
|
53
54
|
"devDependencies": {
|
|
54
|
-
"@turf/truncate": "^
|
|
55
|
+
"@turf/truncate": "^7.0.0-alpha.0",
|
|
55
56
|
"benchmark": "*",
|
|
56
57
|
"load-json-file": "*",
|
|
57
58
|
"npm-run-all": "*",
|
|
@@ -60,11 +61,11 @@
|
|
|
60
61
|
"write-json-file": "*"
|
|
61
62
|
},
|
|
62
63
|
"dependencies": {
|
|
63
|
-
"@turf/clone": "^
|
|
64
|
-
"@turf/helpers": "^
|
|
65
|
-
"@turf/invariant": "^
|
|
66
|
-
"@turf/meta": "^
|
|
67
|
-
"@turf/rhumb-destination": "^
|
|
64
|
+
"@turf/clone": "^7.0.0-alpha.0",
|
|
65
|
+
"@turf/helpers": "^7.0.0-alpha.0",
|
|
66
|
+
"@turf/invariant": "^7.0.0-alpha.0",
|
|
67
|
+
"@turf/meta": "^7.0.0-alpha.0",
|
|
68
|
+
"@turf/rhumb-destination": "^7.0.0-alpha.0"
|
|
68
69
|
},
|
|
69
|
-
"gitHead": "
|
|
70
|
+
"gitHead": "0edc4c491b999e5ace770a61e1cf549f7c004189"
|
|
70
71
|
}
|