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

Hexagons at resolution 16 appear distant from each other not sharing their borders #61

Open
ManuelSpinola opened this issue Feb 1, 2023 · 4 comments

Comments

@ManuelSpinola
Copy link

I am trying to make a grid with specific resolution for the entire world and crop it with a polygon but what I got is the hexagons not sharing their borders (like the South Africa example), they appear separated from each other. How can I make a grid of hexagons of ~ 1km2 área that cover the entire polygon?

dggs <- dgconstruct(res = 16)

cr_grid <- dgshptogrid(dggs, "areas_estrategicas/cr.shp")

@r-barnes
Copy link
Owner

r-barnes commented Feb 1, 2023

It'll be very hard to debug this without more information!

Please provide a screenshot showing the issue and upload the shapefile somewhere.

@ManuelSpinola
Copy link
Author

Sorry,

May be with this example:

dggs <- dgconstruct(res = 16)

sa_grid <- dgshptogrid(dggs, dg_shpfname_south_africa())

p <- ggplot() + geom_sf(data=sa_grid)
p

@r-barnes
Copy link
Owner

r-barnes commented Feb 1, 2023

If I understand correctly, you're concerned that the grid cells for South Africa are not contiguous. That's because they cover the mainland and the offshore island, but not the area in between. It's also the expected behaviour.

If you want coverage for the area in between, maybe construct a bounding box or a convex hull and get the hexes for that?

@ManuelSpinola
Copy link
Author

Thank you Richard.

I was thinking in a "continuous" universal grid that I can crop, but I understand that that is not the expected behavior.

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

2 participants