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

Mismatched column names prevents nhd_plus_query from binding flowlines from two separate HUCs #57

Closed
matthewross07 opened this issue Mar 26, 2019 · 4 comments

Comments

@matthewross07
Copy link

This is an excellent package and really helpful and I'm grateful for your work. I'm hoping to incorporate this package into my workflows, but I came across a small bug today. Basically if you have two different hucs covered by a polygon or coordinates, and the objects in those hucs don't have the same column names, then the flowline (or waterbody) data won't bind. So you get this error message:

Error in rbind.data.frame(...) : numbers of columns of arguments do not match

I looked in your code and couldn't quite figure out where you are binding the nhd data, but happy to help (maybe you can drop some of the less useful NHD PLUS column names and guarantee equal column widths for all data).

Thanks again!

@matthewross07
Copy link
Author

matthewross07 commented Mar 26, 2019

And something more useful. The code below reproduces the error on my machine R 3.5.3:

box = st_bbox(c(xmin=-105.93003,xmax=-104.91784,
                ymin=40.41176,ymax=41.21014),crs=st_crs(4326)) %>%
  st_as_sfc()

poudre_flow <- nhd_plus_query(poly=box,
                               dsn=c('NHDFlowLine'))

jsta added a commit that referenced this issue Mar 27, 2019
@jsta
Copy link
Owner

jsta commented Mar 27, 2019

Thanks for the report! An even simpler command to throw this error is:

nhd_plus_load(vpu = c("10L", "14"), dsn = "NHDFlowLine")

@jsta
Copy link
Owner

jsta commented Mar 27, 2019

The binding happens at: https://github.com/jsta/nhdR/blob/master/R/load.R#L247

This issue is related to r-spatial/sf#49

@jsta jsta closed this as completed in a16d99d Mar 27, 2019
@jsta
Copy link
Owner

jsta commented Mar 27, 2019

@matthewross07 I think the latest commits fix the issue. Let me know if they don't.

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