jbaileyh / geogrid

Turning geospatial polygons into regular or hexagonal grids. For other similar functionality see the tilemaps package https://github.com/kaerosen/tilemaps
Other
393 stars 31 forks source link

Major overhaul to get CRAN-ready #18

Closed hafen closed 6 years ago

hafen commented 6 years ago

This looks a bit lengthy, but in all not much of substance was changed in the package. There are no breaking changes - previous code should still run just fine. Please let me know what you think about the questions raised.

Overview of changes:

Questions:

sassalley commented 6 years ago

Hi @hafen

Thanks for submitting such a fantastic PR. It is thorough and very clear. Please see below for responses to the questions.

  1. Yes - I think calculate_cell_size() should be renamed and the recommendation of calculate_grid() should be adopted. The current name is a bit of a hangover from what's happening underneath but this is not relevant to the user.
  2. Interesting question - in the early stages I was motivated by the generation of Hexmaps but decided to add in the regular grids given that it was a reasonably simple feature. Given that the (likely) main use if for the generation of maps, I think geogrid works. I will crowd-source some more opinions and respond further as soon as possible.
  3. Ah - this should be removed. Initially, the package assigned polygons to the new grid using algorithms (two) other than the Munkres. I decided to remove them since neither algorithm was as effective at mimicking the original geography. Technically it should be "assigns the content of the existing polygons to the new grid using the Hungarian algorithm"

Questions raised in the body of the PR

A few questions in response if i may:

hafen commented 6 years ago

This all sounds great. I just updated my fork to change calculate_cell_size() to calculate_grid() throughout, clarified about the use of the Hungarian algorithm, and added myself as a contributor. I also un-exported get_shape_details() and removed that as an argument to calculate_cell_size() (it's now just called inside that function, saving the user a step).

Given the function name change, these changes are breaking from prior usage and examples, so I also kept the old functions calculate_cell_size() and get_shape_details () which now just display a hard deprecation error and point users to the new functions. Hopefully that is sufficient to get existing users oriented to the changes.

The only outstanding thing is the package name. If you change it, I'd suggest renaming the github repo as well (you can do this without losing your forks / stars, and the old link will redirect to the new one). This is a major change since people already know it by this name, and because of that I was hesitant to suggest it. I'll leave it entirely up to you. The reason I bring it up now is it's easier to change now than when it's on CRAN and more people are using it.