[R-sig-Geo] dissolve internal borders of polygons using st_union and group_by
Marta Rufino
m@rt@@m@ru||no @end|ng |rom gm@||@com
Thu Oct 17 15:13:25 CEST 2019
Dear Roger,
Thank you very much for your quick and dedicated response.
Please state all versions:
> sessionInfo()
> sf_extSoftVersion()
See bellow. I though it was a trivial issue, thus sorry for not reporting
it earlier.
> With an updated system, most of your code just does not work for me.
Just updated everything, r included, and it still runs in my machine -
perhaps because I failed to update to proj6 and I am still using proj4 - I
will have to dedicate more time to overcome it. Is there sites that explain
win-dummies installation?
> You
> are looking for sf::aggregate():
> kk <- aggregate(world_map, list(world_map$continent), head, n=1)
> plot(st_geometry(kk))
>
This will be then a fourth option:
# Answer from ROGER:
kk4 <- aggregate(world_map, list(world_map$continent), head, n=1)
object.size(kk4)
kk4 %>%
ggplot()+
geom_sf()
The sp_transform was simply to check if it was workable the produced file
(in other cases, the code functioned, but then I could not work with the
files produced) - so ok to remove it or change it.
You example using rgeos is really nice and I am grateful for it, but I
really wanted to understand how to do it overall so I can apply in other
situations I am working with.
I don't understand the difference between all those options, that
apparently are giving the same result, but not so much in fact.
Any further ideas on the subject?
Thank you once again,
Best wishes,
M.
> sessionInfo()
R version 3.6.1 (2019-07-05)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)
Matrix products: default
locale:
[1] LC_COLLATE=English_United Kingdom.1252
[2] LC_CTYPE=English_United Kingdom.1252
[3] LC_MONETARY=English_United Kingdom.1252
[4] LC_NUMERIC=C
[5] LC_TIME=English_United Kingdom.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods
[7] base
other attached packages:
[1] rgeos_0.5-2 ggthemes_4.2.0 ggrepel_0.8.1
[4] ggplot2_3.2.1 tidyr_1.0.0 scales_1.0.0
[7] dplyr_0.8.3 reshape2_1.4.3 viridis_0.5.1
[10] viridisLite_0.3.0 units_0.6-5 rnaturalearth_0.1.0
[13] tmap_2.3-1 mapview_2.7.0 plotKML_0.5-9
[16] lubridate_1.7.4 zoo_1.8-6 rasterVis_0.46
[19] latticeExtra_0.6-28 RColorBrewer_1.1-2 lattice_0.20-38
[22] raster_3.0-7 maptools_0.9-8 sf_0.8-0
[25] gstat_2.0-3 rgdal_1.4-6 sp_1.3-1
loaded via a namespace (and not attached):
[1] colorspace_1.4-1 class_7.3-15 colorRamps_2.3
[4] leaflet_2.0.2 htmlTable_1.13.2 satellite_1.0.1
[7] base64enc_0.1-3 dichromat_2.0-0 rstudioapi_0.10
[10] hexbin_1.27.3 fansi_0.4.0 codetools_0.2-16
[13] splines_3.6.1 knitr_1.25 zeallot_0.1.0
[16] Formula_1.2-3 tmaptools_2.0-2 cluster_2.1.0
[19] png_0.1-7 shiny_1.4.0 compiler_3.6.1
[22] backports_1.1.5 assertthat_0.2.1 Matrix_1.2-17
[25] fastmap_1.0.1 lazyeval_0.2.2 cli_1.1.0
[28] later_1.0.0 acepack_1.4.1 htmltools_0.4.0
[31] tools_3.6.1 gtable_0.3.0 glue_1.3.1
[34] Rcpp_1.0.2 vctrs_0.2.0 leafsync_0.1.0
[37] crosstalk_1.0.0 lwgeom_0.1-7 xfun_0.10
[40] stringr_1.4.0 mime_0.7 lifecycle_0.1.0
[43] XML_3.98-1.20 MASS_7.3-51.4 promises_1.1.0
[46] parallel_3.6.1 yaml_2.2.0 gridExtra_2.3
[49] aqp_1.17 rpart_4.1-15 reshape_0.8.8
[52] stringi_1.4.3 plotrix_3.7-6 e1071_1.7-2
[55] checkmate_1.9.4 intervals_0.15.1 rlang_0.4.0
[58] pkgconfig_2.0.3 pixmap_0.4-11 RSAGA_1.3.0
[61] purrr_0.3.2 htmlwidgets_1.5.1 tidyselect_0.2.5
[64] plyr_1.8.4 magrittr_1.5 R6_2.4.0
[67] Hmisc_4.2-0 DBI_1.0.0 pillar_1.4.2
[70] foreign_0.8-72 withr_2.1.2 shapefiles_0.7
[73] xts_0.11-2 survival_2.44-1.1 nnet_7.3-12
[76] tibble_2.1.3 spacetime_1.2-2 crayon_1.3.4
[79] utf8_1.1.4 KernSmooth_2.23-15 grid_3.6.1
[82] data.table_1.12.4 FNN_1.1.3 dismo_1.1-4
[85] digest_0.6.21 classInt_0.4-1 webshot_0.5.1
[88] xtable_1.8-4 httpuv_1.5.2 stats4_3.6.1
[91] munsell_0.5.0
> sf_extSoftVersion()
GEOS GDAL proj.4 GDAL_with_GEOS
"3.6.1" "2.2.3" "4.9.3" "true"
USE_PROJ_H
"false"
>
>
>
[[alternative HTML version deleted]]
More information about the R-sig-Geo
mailing list