-
Notifications
You must be signed in to change notification settings - Fork 33
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
editing + deleting in editFeatures does't work #48
Comments
That comes from |
Thanks @tim-salabim for the report, and thanks @edzer for confirming my suspicion. I think this relates to #32. |
Doing sth similar, I see Error in MtrxSetSet(x, dim, type = "MULTIPOLYGON", needClosed = TRUE) :
polygons not (all) closed details:
|
@edzer what did you do? I cannot seem to reproduce the error you see. |
Are you using the GH version of sf? |
Yes, still the only error I get is |
I can now replicate the |
A quick trial seems to back my suspicion. editFeatures(st_cast(franconia[1:5, ], "POLYGON")) %>%
mapview() does not seem to produce the |
Darn, that is a troubling regression. I will research thoroughly tomorrow and hopefully at least trace the source. |
@edzer, @tim-salabim ok, I am going to need some help here to insure the correct behavior. After quite a bit of research, I don't think this is a regression in
which gives us
Compounding the ProblemIn the simple case above with If you tell me, this is ok, then we can just do as above and |
As we found out earlier, the st_geometry(fran2[1,]) <- st_geometry(st_cast(franconia[1,],"POLYGON")) causes trouble because it has a nested replacement function ( Why don't you simply use st_cast(franconia, "POLYGON") to cast > lengths(st_geometry(franconia))
[1] 1 2 1 1 2 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 points you to the multi ones. |
That is where I need help from more experienced geo people in trying to determine the best "solution". I unfortunately don't have the domain expertise to know if cast to polygon first is acceptable. @tim-salabim, do you have a recommendation? @edzer, I just can't stop myself with the nested assignment, but that does not seem to be the problem here. Any alternative gives us the same error, since it seems the problem is
|
@edzer, would the correct way to do this be this or a derivative?
|
Yes, or the shorter: fran_g <- st_geometry(franconia)
fran_g[1] <- st_cast(fran_g[1], "POLYGON")
fran_g2 <- st_sfc(fran_g)
plot(fran_g2) |
I will try to find some time to have a closer look at this tomorrow, though may not be able to investigate until Thursday. From a first rough look (and as I mentioned before) a cast to |
Some of this might be "solved" by fixing the merge as @edzer suggested. This will be only a partial fix, but I think it will be at least better than current. I will try in the morning. |
@timelyportfolio all of your examples with subsetting in it should now work - thanks for examples & the patience! |
didn't know I was being helpful but delighted to know that I might have been :) This will make |
Now that my flawed assignment works :), we can focus on the optimal solution for franconia[2,]holes |
In both cases, In case 1 ( In case 2 (holes), the target for merge is |
can you post the structure of how these two come back from |
@tim-salabim, yes definitely. Will post once I remove my own ignorance/stupidity from potential source of error :) |
Ok, @tim-salabim, will you look over my shoulder and see what I might be missing? The merged edit looks like this, which looks correct to me.
... but when I
|
Going to see if |
Yeah, my first thought also |
working myself into a circle and don't want to tangle you up in the whirlpool. I think I copy/pasted wrong bit. Will wait to post again until I convince myself that I am showing correct pieces. |
I think I found source. Will report back. |
If you get some time, please test #52. If your tests all work, I think this issue might be resolved leaving only
|
Two observations:
Warning message:
In sf::st_geometry(orig2)[matched_id_rows] <- sf::st_geometry(edits) :
number of items to replace is not a multiple of replacement length and only the first edits are saved (though anything I add/draw after the first save is kept). |
I've just tested
editFeatures(mapview::trails[1, ]) # works
editFeatures(mapview::trails[4, ]) # doesn't work |
@tim-salabim, I bet the |
sure |
working on the other multi* now |
@tim-salabim, first quick exploration reveals |
Got cast to original implemented but discovered a new issue with |
I think I have previous bugs resolved, Now back to |
After a quick trial this morning I seem to be able to confirm that
now work as expected. |
going to move the |
@tim-salabim, I think we can close this, since the remaining unresolved |
Agreed |
When I do
and in that session both delete a feature and edit another one, I get the error:
traceback
:The text was updated successfully, but these errors were encountered: