-
Notifications
You must be signed in to change notification settings - Fork 4
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
Add depth parameter #46
Conversation
Thank you @ClaroHenrique for starting this PR ❤️ We need to replace the option Please let me know if something is not clear. I can provide a simple example with states and cities in Brazil. |
Hi @juliohm, I think i get it now. Is there a problem if the resulting single table hold all those columns? |
Hi @ClaroHenrique can you provide an example of result with Brazil data? What are the tables we get when we set level=0,1,2? We can then try to figure out a combination of columns that makes sense in general. |
@juliohm, those are the results from the database downloaded in https://data.biogeo.ucdavis.edu/data/gadm3.6/gpkg/gadm36_BRA_gpkg.zip. |
Nice, so the idea is that if a user types get("BRA", "Alagoas", level=1) we return all the cities of Alagoas in a single table. This consists of filtering the rows of the table of level 2 that have Alagoas as the state. More generally, we want get(country, state, city, municipality, ..., level=n) to return all the leaves of the node country->state->city->municipality that are n steps deeper in the tree. This could be implemented with different algorithms. We could use a depth-first-search starting from the municipality to find the children at depth n. We then push these tables to a list of tables to be merged. At the end all these tables will be at the same level, so we should expect them to have the same columns. If they don't have the same columns, we should probably investigate the issue further. I can take a closer look at the dataset if it is still not clear what the end goal is. |
It's fine. I just missunderstood this message. |
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.
@ClaroHenrique this is an amazing PR. Thank you for improving the API, the code is very elegant.
Co-authored-by: Júlio Hoffimann <[email protected]>
This PR aims to add the
depth
parameter in theGADM.get
function.This feature is mentioned in issue 40.