transformTranslate
Description
Moves any geojson Feature or Geometry of a specified distance along a Rhumb Line on the provided direction angle.
Parameters
Name | Type | Description |
---|---|---|
geojson | GeoJSON | object to be translated |
distance | number | length of the motion; negative values determine motion in opposite direction |
direction | number | of the motion; angle from North in decimal degrees, positive clockwise |
options? | Object | Optional parameters (default {}) |
options.units? | string | in which distance will be express; miles, kilometers, degrees, or radians (default 'kilometers') |
options.zTranslation? | number | length of the vertical motion, same unit of distance (default 0) |
options.mutate? | boolean | allows GeoJSON input to be mutated (significant performance increase if true) (default false) |
Returns
GeoJSON the translated GeoJSON object
Examples
var poly = turf.polygon([
[
[0, 29],
[3.5, 29],
[2.5, 32],
[0, 29],
],
]);
var translatedPoly = turf.transformTranslate(poly, 100, 35);
Installation
$ npm install @turf/transform-translate
import { transformTranslate } from "@turf/transform-translate";
const result = transformTranslate(...);
$ npm install @turf/turf
import * as turf from "@turf/turf";
const result = turf.transformTranslate(...);