-
Notifications
You must be signed in to change notification settings - Fork 13
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
Handle special column classes more elegantly #69
Comments
Oh your second point is very interesting! I'm not quite sure what you mean by doing data frame traversal first... right now it collects the information about the columns in |
The scenario in mind is when the geometric conversion takes some time, and presumably succeeds - but then we fail on some data column - so could we fail on the data column first, before the geom operation? I'm also guessing that a loop for the "{ }" check would be better than a "[<-" replacement, but I haven't checked yet. It's probably not important if we get the restoration right :) but it's caught me out many times. |
It's very possible I'm missing something, but the data column parsing has to happen after the geometric conversion because the sequence of events is: sf/sp -> geojson -> into v8 context -> mapshaper magic -> out of v8 context -> geojson -> sf/sp. It's this last geojson -> sf/sp where we are restoring column classes and that's where the failure happens. Unless.... what if we remove all of the attributes except a row id before passing the object into the v8 context, and rejoin the attributes to the processed spatial object when done? Then we could avoid all of that messiness of storing and restoring column classes, and it would have the added benefit of making the geojson object that gets sent into the v8 context smaller (if there were lots of attributes). |
Oh true, I forget it's not a one-to-one output, you're quite right! Your last proposal sounds good, and should work. |
I think it's going to require a bit more thought around dealing with objects that end up being aggregated/disaggregated (thinking especially |
- Split attributes off from spatial and rejoin after mapshaper does its thing
(just some notes for now, @ateucher please assign to me)
as.Date(c("", "2001-01-01")) ## is an error but
as.Date(c("2001-01-01", "")) ## gives an NA in 2nd place
The text was updated successfully, but these errors were encountered: