-
Notifications
You must be signed in to change notification settings - Fork 297
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
Combine polygons by attribute #382
Comments
Which lines do you see? You're sure these are not holes? |
Yes, I'm certain. Data before
Data after
|
None of the geometries you get are actual lines, all have dimension 2 and positive area: > world_continents2[1] %>% st_area() %>% units::set_units(km^2)
Units: km^2
[1] 29946212.22 12335958.52 31252444.82 23065279.95 24484309.31 8504478.20
[7] 11602.57 17762597.45
> world_continents2[1] %>% st_dimension()
[1] 2 2 2 2 2 2 2 2 what is of course possible is that there's no man's land between polygons. Africa seems to have 4 holes: > world_continents2[1] %>% st_cast("MULTIPOLYGON") %>% st_geometry() %>% sapply(lengths)
[[1]]
[1] 1 5
[[2]]
[1] 1 1 1 1 1 1 1 1
[[3]]
[1] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1
[[4]]
[1] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1
[[5]]
[1] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
[39] 1 1 1 1 1 1 1 1 1
[[6]]
[1] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
[[7]]
[1] 1
[[8]]
[1] 1 1 1 Maybe use mapview to explore them, and mapedit to remove them? |
Thanks for the use-case :-) |
@edzer Thanks for the investigation. I'm just still unsure why the number and location of these holes changes with different values of a "precision". @tim-salabim I'll definitely try to use mapedit. |
@Nowosad see also |
related to #275
I've combined polygons by attribute using
group_by()
andsummarise()
. It leaves some lines, so I've tried @edzer tip about usingst_set_precision()
. However, every value I've tested (100 - 1000000000) keeps some "artefacts". What's the best way to deal with that kind of problems?The text was updated successfully, but these errors were encountered: