-
Notifications
You must be signed in to change notification settings - Fork 299
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
Possible conflict sf and tmap #2043
Comments
Not sure if related to my tmap issue. I found something on sf and tested with their code demonstrations using their http://127.0.0.1:31629/doc/html/Search?package=sf&agrep=0&types.demo=1&pattern= Test: Return: Test: Retturn: Test: Return |
Could you share some reproducible code @donojazz ? Have you tried to apply |
Here it is, I tried adding in this code but it didn't help : tmap_options(check.and.fix = TRUE) Not sure why the problems. Initial problem was tidyverse will not load. Once I deleted old versions, and files, then reloaded R and RStudio and libraries tidyverse worked but my older (2 day old) containing tmap would not. The sample below was from your tmap documentation. I will try your suggestion. Thanks. library(tigris)
#> To enable caching of data, set `options(tigris_use_cache = TRUE)`
#> in your R script or .Rprofile.
library(sf)
#> Linking to GEOS 3.9.3, GDAL 3.5.2, PROJ 8.2.1; sf_use_s2() is TRUE
library(dplyr)
#>
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#>
#> filter, lag
#> The following objects are masked from 'package:base':
#>
#> intersect, setdiff, setequal, union
library(tmap)
data(World, metro)
tmap_mode("view")
#> tmap mode set to interactive viewing
tm_basemap(leaflet::providers$CartoDB.PositronNoLabels, group = "CartoDB basemap") +
tm_shape(World) +
tm_polygons("HPI", group = "Countries") +
tm_tiles(leaflet::providers$CartoDB.PositronOnlyLabels, group = "CartoDB labels") +
tm_shape(metro) +
tm_dots(col = "red", group = "Metropolitan areas")
#> old-style crs object detected; please recreate object with a recent sf::st_crs()
#> old-style crs object detected; please recreate object with a recent sf::st_crs()
#> old-style crs object detected; please recreate object with a recent sf::st_crs()
#> Error: Shape contains invalid polygons. Please fix it or set tmap_options(check.and.fix = TRUE) and rerun the plot Created on 2022-11-18 with reprex v2.0.2 |
Works fine for me, with
|
Any ideas where I should start digging? Think it may be a windows thing causing it. Jenny said to remove all the extraneous vctrs files. I got rid of 7 and only one left is the one I installed on 11/17. |
I kept searching around for ideas and someone here suggested I make sure geos is installed. I tryied installing from R Studio and it failed. Then I installed directly from console directly. These files finally loaded: package ‘libgeos’ successfully unpacked and MD5 sums checked Part of the error message was: Bottom line: tmap runs that reprex code I sent. I think the problem is fixed. Thanks. Jim |
I love tmap and have been using it constantly for the 30 Day Map Challenge. It has been working great until yesterday on code that ran great 2 days ago, I now get:
Error: Shape contains invalid polygons. Please fix it or set tmap_options(check.and.fix = TRUE) and rerun the plot
constantly. After playing with marmap and having it hose my R environmant, especially tidyverse. I had to delete my entire R environment along with libraries. I worked with Jenny Bryan and she helped with the tidyverse issue tidyverse/tidyverse#316 (comment) We agreed about the fresh start with R. But, now, I am getting errors with tmap. I am getting the same errors off your sample vignettes (tmap: version changes). Can you assist? Thanks. Jim
Here is my sys info.
R version 4.2.2 (2022-10-31 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19044)
Matrix products: default
locale:
[1] LC_COLLATE=English_United States.utf8 LC_CTYPE=English_United States.utf8
[3] LC_MONETARY=English_United States.utf8 LC_NUMERIC=C
[5] LC_TIME=English_United States.utf8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] DT_0.26 mapview_2.11.0 tigris_1.6.1 spdplyr_0.4.0 readxl_1.4.1
[6] rgdal_1.6-2 sp_1.5-1 sf_1.0-9 tmaptools_3.1-1 tmap_3.3-3
[11] leaflet_2.1.1 forcats_0.5.2 stringr_1.4.1 dplyr_1.0.10 purrr_0.3.5
[16] readr_2.1.3 tidyr_1.2.1 tibble_3.1.8 ggplot2_3.4.0 tidyverse_1.3.2
loaded via a namespace (and not attached):
[1] googledrive_2.0.0 leafem_0.2.0 colorspace_2.0-3
[4] ellipsis_0.3.2 class_7.3-20 satellite_1.0.4
[7] base64enc_0.1-3 fs_1.5.2 dichromat_2.0-0.1
[10] rstudioapi_0.14 proxy_0.4-27 bit64_4.0.5
[13] fansi_1.0.3 lubridate_1.9.0 xml2_1.3.3
[16] codetools_0.2-18 cachem_1.0.6 knitr_1.40
[19] jsonlite_1.8.3 broom_1.0.1 dbplyr_2.2.1
[22] png_0.1-7 compiler_4.2.2 httr_1.4.4
[25] backports_1.4.1 assertthat_0.2.1 fastmap_1.1.0
[28] gargle_1.2.1 cli_3.4.1 leaflet.providers_1.9.0
[31] htmltools_0.5.3 tools_4.2.2 gtable_0.3.1
[34] glue_1.6.2 rappdirs_0.3.3 Rcpp_1.0.9
[37] jquerylib_0.1.4 cellranger_1.1.0 raster_3.6-3
[40] vctrs_0.5.0 leafsync_0.1.0 crosstalk_1.2.0
[43] lwgeom_0.2-9 xfun_0.34 rvest_1.0.3
[46] timechange_0.1.1 lifecycle_1.0.3 XML_3.99-0.12
[49] googlesheets4_1.0.1 terra_1.6-17 scales_1.2.1
[52] vroom_1.6.0 hms_1.1.2 parallel_4.2.2
[55] RColorBrewer_1.1-3 curl_4.3.3 yaml_2.3.6
[58] sass_0.4.2 stringi_1.7.8 maptools_1.1-5
[61] e1071_1.7-12 rlang_1.0.6 pkgconfig_2.0.3
[64] spbabel_0.5.5 evaluate_0.18 lattice_0.20-45
[67] htmlwidgets_1.5.4 bit_4.0.4 tidyselect_1.2.0
[70] magrittr_2.0.3 R6_2.5.1 generics_0.1.3
[73] DBI_1.1.3 pillar_1.8.1 haven_2.5.1
[76] foreign_0.8-83 withr_2.5.0 units_0.8-0
[79] stars_0.5-6 abind_1.4-5 modelr_0.1.10
[82] crayon_1.5.2 uuid_1.1-0 KernSmooth_2.23-20
[85] utf8_1.2.2 tzdb_0.3.0 rmarkdown_2.18
[88] grid_4.2.2 reprex_2.0.2 digest_0.6.30
[91] classInt_0.4-8 webshot_0.5.4 stats4_4.2.2
[94] munsell_0.5.0 viridisLite_0.4.1 bslib_0.4.1
Originally posted by @donojazz in #1649 (comment)
The text was updated successfully, but these errors were encountered: