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

Cannot create squareGrid from FeatureCollection #1830

Closed
adkalkan opened this issue Feb 5, 2020 · 1 comment · Fixed by #1885
Closed

Cannot create squareGrid from FeatureCollection #1830

adkalkan opened this issue Feb 5, 2020 · 1 comment · Fixed by #1885
Labels

Comments

@adkalkan
Copy link

adkalkan commented Feb 5, 2020

I'm using turf alongside mapbox.

squareGrid's definition reads:

Creates a square grid from a bounding box, Feature or FeatureCollection.

yet whenever I input a Feature collection, the error I get is:

bbox must be array.

Here is some sample code:

var locationA = turf.point([-75.343, 39.984], {edx: 5.1});
var locationB = turf.point([-75.833, 39.284], {edx: 45.4});
var locationC = turf.point([-75.534, 39.123], {edx: -11.1});

var collection = turf.featureCollection([locationA,locationB,locationC]);
var squareGrid = turf.squareGrid(collection, 25, /*options*/);

What am I missing here? I would like to create a square grid from a feature collection that has points with properties, and paint the grid cells according to the property value.
Is my way of thinking wrong?

@adkalkan adkalkan changed the title How to create squareGrid from FeatureCollection Cannot create squareGrid from FeatureCollection Feb 5, 2020
@stebogit
Copy link
Collaborator

@adkalkan you are right, the documentation is incorrect. squareGrid only accepts a bbox array.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants