-
Notifications
You must be signed in to change notification settings - Fork 119
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
Error: Edge 46 crosses edge 48 #340
Comments
Is it correct to use the sf_use_s2(FALSE) command before running the neighborhood matrix? |
could you please share the code with a reproducible example? |
@marianaosb, could you please share the code with a reproducible example that returns this error ? |
Hi @rafapereirabr ! I think I had a similar problem as @marianaosb when trying to use My real groups are different, but to create an easy reproducible example let's say that I have all the municipalities and want to unify their shape by the region (I know this could be accomplished by using directly the states dataset, but as I mentioned this is just a toy example). This is the initial code:
Which gives this error:
If I set
The way I was able to fix the error was by setting globally setting this sf flag:
This works both for For For The error is gone, but the state shapes still have some internal polygons. I was able to get rid of these by using When using When using For reference, this is the full code of this last image map, which in my opinion is the best:
@rafapereirabr I'm reporting all of these to (1) help other people that might be also trying to union some shapes and having issues, and (2) to help you debugging a potential bug in the shapes dataset or the library. I say potential because I'm not sure if there is really any problem with the library and datasets, but I hope that my reports could help understand better what is happening. |
Hi @gabrielmagno , thanks a lot for sharing this. It's super helpful. When users need to do any operation of the geometry column (e.g. calculating areas, merging/dissolving borders, creating contiguity matrices etc), it is strongly recommended to download the data using This issue you both have reported suggests some issue with the geometry might still persist for some years even when setting |
Hi,
I've used read_municipality(simplified = FALSE) to load the date by municipality. But when I try to make a Queen neighbours Matrix, the following erro occur:
Error in wk_handle.wk_wkb(wkb, s2_geography_writer(oriented = oriented, :
Loop 0 is not valid: Edge 46 crosses edge 48
How can I fix that?
The text was updated successfully, but these errors were encountered: