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

SquareGrid lower then bbox #1214

Closed
winsento opened this issue Jan 8, 2018 · 6 comments
Closed

SquareGrid lower then bbox #1214

winsento opened this issue Jan 8, 2018 · 6 comments

Comments

@winsento
Copy link

winsento commented Jan 8, 2018

SquareGrid lower then bbox:

image

@rowanwins
Copy link
Member

What exactly is the question @winsento ?

@winsento
Copy link
Author

winsento commented Jan 8, 2018

@rowanwins Why squareGrid lower then bbox? And how to make the grid fully cover the polygon?

@rowanwins
Copy link
Member

turf/square-grid calculates how many cells will fit in your bbox according to the cell size that you pass, if it doesnt fit exactly then it centers things accordingly.

If you want them to align exactly I'd suggest calculating the width of your bounding box first, and then adjusting the cell size accordingly.

Hope that helps

@winsento
Copy link
Author

winsento commented Jan 8, 2018

@rowanwins Yes, that helps. Thank you.

@winsento winsento closed this as completed Jan 8, 2018
@stefanocudini
Copy link

hi,

I have the same problem and I find this behavior strange!

but would it be possible to pass the count of cells for each side instead of the size in kilometers/miles?
it should be a parameter that makes more sense

@mfnash
Copy link

mfnash commented Aug 10, 2023

Hi,
I have already calculate the width and height of bbox that must be fit with cell size, but the result is not.

image

with this bbox, the grid can contain 10 columns and 3 rows, but the result is 9 columns and 2 rows (and the grid centered).
how to solve this ?

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

No branches or pull requests

4 participants