Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@turf/point-grid - change centered param default to True #833

Closed
DenisCarriere opened this issue Jul 10, 2017 · 2 comments
Closed

@turf/point-grid - change centered param default to True #833

DenisCarriere opened this issue Jul 10, 2017 · 2 comments
Assignees
Milestone

Comments

@DenisCarriere
Copy link
Member

DenisCarriere commented Jul 10, 2017

@turf/point-grid - change centered param default to True

Seems like the centered property should default to True instead of False/undefined since this option would be most useful all the time.

poinGrid(box, cellSize, units)
//= centered param would equal True (even if defined as undefined)

JSDocs

/**
 * Creates a {@link Point} grid from a bounding box, {@link FeatureCollection} or {@link Feature}.
 *
 * @name pointGrid
 * @param {Array<number>|FeatureCollection|Feature<any>} bbox extent in [minX, minY, maxX, maxY] order
 * @param {number} cellSide the distance between points
 * @param {string} [units=kilometers] used in calculating cellSide, can be degrees, radians, miles, or kilometers
 * @param {boolean} [centered=true] adjust points position to center the grid into bbox
 * @param {boolean} [bboxIsMask=false] if true, and bbox is a Polygon or MultiPolygon, the grid Point will be created
 * only if inside the bbox Polygon(s)
 * @returns {FeatureCollection<Point>} grid of points
 */
module.exports = function (bbox, cellSide, units, centered, bboxIsMask) {

Ref: Issue #613
CC: @stebogit

@DenisCarriere DenisCarriere added this to the 4.6.0 milestone Jul 10, 2017
@stebogit
Copy link
Collaborator

stebogit commented Jul 10, 2017

@DenisCarriere 👍 that make sense, but why not just have the output always centered, removing the parameter (maybe in v.5.0)?
Why/when should the output ever be off?

@DenisCarriere
Copy link
Member Author

Why/when should the output ever be off?

Agreed, dropping the parameter would be fine, there's really no benefit of having an inconsistent offset grid.

We can change the value to True for the minor release, and if we remember, we can drop it in the next major release (whenever that happens).

stebogit added a commit that referenced this issue Jul 12, 2017
simplified tests;
updated all relevant files;
DenisCarriere pushed a commit that referenced this issue Jul 12, 2017
* set centered param default to True (fix #833):
simplified tests;
updated all relevant files;

* Update Typescript definition
@DenisCarriere DenisCarriere self-assigned this Aug 2, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants