question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

New module proposal: Transform

See original GitHub issue

Inspired by PR #729 and the necessity to use a rotated gridPoint as turf-isobands input, I’d like to implement the following basic transformation functions, if of interest in Turf:

@turf/transform-translate

  • Moves a feature of distance kilometers (or units) on a specific direction angle
  • 3rd (z) coordinates support
/**
@param {GeoJSON}` **object** to be translated
@param {Number}` **distance** length of the motion
@param {Number}` **direction** angle/bearing of the motion, in degrees from North (positive clockwise)
@param {String}` **units** (optional, default Km) unit for distance
@returns {Feature<any>}` the translated Feature

screen shot 2017-05-17 at 12 11 25 am

@turf/transform-scale

  • Enlarges or shrinks a feature by a scale factor.
  • 3rd (z) coordinates support
/**
@param {GeoJSON}` **object** to be scaled
@param {Number}` **factor** scale factor (positive number)
@param {Feature|Geometry<Point>|Array<number>}` **origin** point (of the Feature) around which the scaling will occur, defaults to centroid
@returns {Feature<any>}` the scaled Feature

screen shot 2017-05-17 at 12 14 20 am

@turf/transform-rotate

  • Rotates a feature of angle degrees around a fixed point (default to its center/center of mass/centroid)
  • 3rd (z) coordinates support (rotation only by z axis, i.e. on the x,y plane)
/**
@param {GeoJSON}` **object** to be rotated
@param {Number}` **angle** extent of the rotation, in degrees from North (positive clockwise)
@param {Feature|Geometry<Point>|Array<number>}` **pivot**, point around which the rotation will occur, defaults to `centroid`
@returns {Feature<any>}` the rotated Feature

screen shot 2017-05-17 at 12 18 13 am

Geometry Support

  • Geometry|Feature<Point> => Feature<Point>
  • Geometry|Feature<LineString> => Feature<LineString>
  • Geometry|Feature<Polygon> => Feature<Polygon>
  • Geometry|Feature<MultiPoint> => Feature<MultiPoint>
  • Geometry|Feature<MultiLineString> => Feature<MultiLineString>
  • Geometry|Feature<MultiPolygon> => Feature<MultiPolygon>

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:5
  • Comments:19 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
DenisCarrierecommented, May 29, 2017
1reaction
DenisCarrierecommented, May 18, 2017

My 👍 votes for the following:

  • 3 coordinates support (on initial draft don’t worry about it too much, as long as the 3rd coordinate isn’t dropped)
  • having 3 separate modules for this proposal (initial names defined by @stebogit, @turf/transform-rotate, @turf/transform-translate, @turf/transform-scale)
  • pivot param name for @turf/transform-rotate
  • origin param for `@turf/transform-scale
Read more comments on GitHub >

github_iconTop Results From Across the Web

Proposal Creation
In this module you will learn how to: ▫ Create a new proposal. ▫ Navigate the proposal. ▫ Assign proposal permissions. ▫ Track...
Read more >
Module 5 | UCLA OCGA
In this module you will learn how to: ❑Create a new proposal. ❑Navigate the proposal ... ❑Lock/Break Lock. ❑Copy/Transform proposals. Objectives ...
Read more >
Proposal for a New Module ARO 035b - University of Stirling
Proposal for a New Module ARO 035b. This form should be used, in conjunction with the Module Descriptor (ARO 035a) to submit new...
Read more >
BUS 6120 Module 4 Resistance Transformation Proposal ...
Module answer and details for the course bus 6120 module resistance transformation proposal worksheet directions: use this worksheet to create proposal to.
Read more >
babel/plugin-proposal-dynamic-import depends on a modules ...
My repo has babel-jest installed, and my project's babel.config.js is this: module.exports = { presets: [ [ "@babel/preset ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found