-
Couldn't load subscription status.
- Fork 1
add derive_grid() to generate grids from INSPIRE IDs (#3) #8
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
base: main
Are you sure you want to change the base?
Conversation
|
Hi, @JsLth ! Thanks for your interest and thoughtful PR as well as detailed explanation! I will need a few days to look at it and test, will try to get back to you by Monday next week. Right away a few technical comments:
Last point 3 leads to:
These may be points for you to consider when relying on it in https://github.com/denabel/gxc , depending on our timeline for it's release. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @JsLth, overall very solid code, but there are a few issues I identified during quick manual testing. Kindly see the comments in this code review. Would you mind addressing these before I do another test, as I could not test everything beacuse of unknown regex_match.
…gument flexibility
…troids are passed
|
Note that I decided to polish the heuristics of Additionally, |
I don't have that much experience with these grids. I started working on the package because of OxfordDemSci/Mapineq#194 and https://github.com/e-kotov/tphconv . Transport Poverty Hub gives back centroids in WGS84, as they assume (I guess) that the user will be using those as is. I guess very often data in the wild will be centroids of grids. We can change it later (e.g. following suggestions from rOpenSci review).
pkgcheck::fn_names_on_cran("create_grid")
package version fn_name
217232 potential 0.1.0 create_grid
232007 raceland 1.1.2 create_grid
301697 sugarbag 0.1.3 create_grid
339647 xnet 0.1.11 create_gridMaybe the name for the main function should be changed to |
Gladly, go ahead!
AFAIK, none of these packages are very common and likely to clash with If you want to prevent any namespace conflicts, what about including |
|
Ok, I will make some commits soon. Good catch with the res->cellsize, I was about to adjust it as my test just caught an error on this line ;)
Good suggestion, I will consider it. It also leaves the room for possible future extensions of this package beyond just INSPIRE grid. |
|
Note: there is still another legacy format with easting first, then northing widely used in both legacy and newer data. E.g.:
No action needed, I am working on it. |
|
I added tests to all functions, made them error on NAs and malformed IDs, added support for reversed short codes (with easting before northing), and added I am also still thinking about function names. I am still having hard time distinguishing between derive, extract and generate ;) Maybe something more explicit? create_grid -> inspire_extent_to_grid (which also suggests that the whole package should just be called |
Hi @e-kotov, neat package, thanks!
We can make good use of the package over at denabel/gxc, but we were looking for a feature to derive polygons from identifiers. As you also intend to add such a functionality (#3), I decided to give it a go.
This pull request adds three exported functions:
derive_grid()to create a spatial grid from INSPIRE IDs,inspire_extract()to extract points from an INSPIRE string, andinspire_generate()to generate an INSPIRE string from points. The latter two are taken and slightly edited from my package jslth/z22.derive_grid()is powered byinspire_extract(), the other function is what I thought would be a nice add-on.Also, given your other remark in #3, I slightly modularized the code in
create_grid_internaland added an internal functionas_grid, which takes over task 7: handle output type. I re-use the function inderive_grid()to create the grid from the extracted points.I changed the default of
point_typeinderive_grid()tollc, as that (AFAIK) is the established standard in INSPIRE IDs.I haven't looked into your implementations of mirai and future yet, so as a first step, I only implemented the sequential function. Also, I have not done heavy testing.
z22runs some basic tests based on the standard cell sizes (100m, 250m, 1km, 10km, 100km), but from what I can see (correct me if I'm wrong),gridmakeralso handles non-standard cell sizes. I didn't get to testderive_grid()in this manner.A quick example demonstrating the function's use:
Please let me know what you think and if I should add or change anything!