r-tmap / tmap

R package for thematic maps
https://r-tmap.github.io/tmap
GNU General Public License v3.0
868 stars 121 forks source link

incorrect projection view mode #891

Closed mtennekes closed 5 months ago

mtennekes commented 5 months ago
# downloaded at https://ec.europa.eu/eurostat/web/gisco/geodata/administrative-units/countries

# read and preprocess data
eu <- st_read("ref-countries-2020-20M/CNTR_RG_20M_2020_3035.geojson") |> 
  mutate(EU_STAT = (EU_STAT == "T"),
         EFTA_STAT = (EFTA_STAT == "T"),
         CC_STAT = (CC_STAT == "T")) |> 
  filter(EU_STAT)

# correct
tm_shape(eu) +
  tm_polygons()

# incorrect
tmap_mode("view")
tm_shape(eu) +
  tm_polygons()

image

mtennekes commented 5 months ago

The same issue with tmap 3.3-4. Apparently, this seems to be an issue with a dependency, or the data file. Could you please check, @Nowosad , @olivroy , or @Robinlovelace ?

─ Session info ─────────────────────────
 setting  value
 version  R version 4.4.0 (2024-04-24)
 os       macOS Sonoma 14.4.1
 system   aarch64, darwin20
 ui       RStudio
 language (EN)
 collate  en_US.UTF-8
 ctype    en_US.UTF-8
 tz       Europe/Amsterdam
 date     2024-06-21
 rstudio  2024.04.2+764 Chocolate Cosmos (desktop)
 pandoc   NA

─ Packages ─────────────────────────────
 package           * version     date (UTC) lib source
 abind               1.4-5       2016-07-21 [1] CRAN (R 4.4.0)
 base64enc           0.1-3       2015-07-28 [1] CRAN (R 4.4.0)
 class               7.3-22      2023-05-03 [1] CRAN (R 4.4.0)
 classInt            0.4-10      2023-09-05 [1] CRAN (R 4.4.0)
 cli                 3.6.2       2023-12-11 [1] CRAN (R 4.4.0)
 codetools           0.2-20      2024-03-31 [1] CRAN (R 4.4.0)
 colorspace          2.1-0       2023-01-23 [1] CRAN (R 4.4.0)
 crosstalk           1.2.1       2023-11-23 [1] CRAN (R 4.4.0)
 DBI                 1.2.3       2024-06-02 [1] CRAN (R 4.4.0)
 dichromat           2.0-0.1     2022-05-02 [1] CRAN (R 4.4.0)
 digest              0.6.35      2024-03-11 [1] CRAN (R 4.4.0)
 dplyr             * 1.1.4       2023-11-17 [1] CRAN (R 4.4.0)
 e1071               1.7-14      2023-12-06 [1] CRAN (R 4.4.0)
 fansi               1.0.6       2023-12-08 [1] CRAN (R 4.4.0)
 fastmap             1.2.0       2024-05-15 [1] CRAN (R 4.4.0)
 forcats           * 1.0.0       2023-01-29 [1] CRAN (R 4.4.0)
 generics            0.1.3       2022-07-05 [1] CRAN (R 4.4.0)
 ggplot2           * 3.5.1       2024-04-23 [1] CRAN (R 4.4.0)
 glue                1.7.0       2024-01-09 [1] CRAN (R 4.4.0)
 gtable              0.3.5       2024-04-22 [1] CRAN (R 4.4.0)
 hms                 1.1.3       2023-03-21 [1] CRAN (R 4.4.0)
 htmltools           0.5.8.1     2024-04-04 [1] CRAN (R 4.4.0)
 htmlwidgets         1.6.4       2023-12-06 [1] CRAN (R 4.4.0)
 jquerylib           0.1.4       2021-04-26 [1] CRAN (R 4.4.0)
 jsonlite            1.8.8       2023-12-04 [1] CRAN (R 4.4.0)
 KernSmooth          2.23-24     2024-05-17 [1] CRAN (R 4.4.0)
 lattice             0.22-6      2024-03-20 [1] CRAN (R 4.4.0)
 leafem              0.2.3       2023-09-17 [1] CRAN (R 4.4.0)
 leaflet             2.2.2       2024-03-26 [1] CRAN (R 4.4.0)
 leaflet.providers   2.0.0       2023-10-17 [1] CRAN (R 4.4.0)
 leafsync            0.1.0       2019-03-05 [1] CRAN (R 4.4.0)
 lifecycle           1.0.4       2023-11-07 [1] CRAN (R 4.4.0)
 lubridate         * 1.9.3       2023-09-27 [1] CRAN (R 4.4.0)
 lwgeom              0.2-14      2024-02-21 [1] CRAN (R 4.4.0)
 magrittr            2.0.3       2022-03-30 [1] CRAN (R 4.4.0)
 munsell             0.5.1       2024-04-01 [1] CRAN (R 4.4.0)
 pillar              1.9.0       2023-03-22 [1] CRAN (R 4.4.0)
 pkgconfig           2.0.3       2019-09-22 [1] CRAN (R 4.4.0)
 png                 0.1-8       2022-11-29 [1] CRAN (R 4.4.0)
 proxy               0.4-27      2022-06-09 [1] CRAN (R 4.4.0)
 purrr             * 1.0.2       2023-08-10 [1] CRAN (R 4.4.0)
 R6                  2.5.1       2021-08-19 [1] CRAN (R 4.4.0)
 raster              3.6-26      2023-10-14 [1] CRAN (R 4.4.0)
 RColorBrewer        1.1-3       2022-04-03 [1] CRAN (R 4.4.0)
 Rcpp                1.0.12      2024-01-09 [1] CRAN (R 4.4.0)
 readr             * 2.1.5       2024-01-10 [1] CRAN (R 4.4.0)
 rlang               1.1.4       2024-06-04 [1] CRAN (R 4.4.0)
 rstudioapi          0.16.0      2024-03-24 [1] CRAN (R 4.4.0)
 s2                  1.1.6       2023-12-19 [1] CRAN (R 4.4.0)
 scales              1.3.0       2023-11-28 [1] CRAN (R 4.4.0)
 sessioninfo         1.2.2       2021-12-06 [1] CRAN (R 4.4.0)
 sf                * 1.0-16      2024-03-24 [1] CRAN (R 4.4.0)
 sp                  2.1-4       2024-04-30 [1] CRAN (R 4.4.0)
 stars               0.6-5       2024-04-04 [1] CRAN (R 4.4.0)
 stringi             1.8.4       2024-05-06 [1] CRAN (R 4.4.0)
 stringr           * 1.5.1       2023-11-14 [1] CRAN (R 4.4.0)
 terra               1.7-78      2024-05-22 [1] CRAN (R 4.4.0)
 tibble            * 3.2.1       2023-03-20 [1] CRAN (R 4.4.0)
 tidyr             * 1.3.1       2024-01-24 [1] CRAN (R 4.4.0)
 tidyselect          1.2.1       2024-03-11 [1] CRAN (R 4.4.0)
 tidyverse         * 2.0.0       2023-02-22 [1] CRAN (R 4.4.0)
 timechange          0.3.0       2024-01-18 [1] CRAN (R 4.4.0)
 tmap              * 3.3-4       2023-09-12 [1] CRAN (R 4.4.0)
 tmaptools         * 3.1-1       2021-01-19 [1] CRAN (R 4.4.0)
 tzdb                0.4.0       2023-05-12 [1] CRAN (R 4.4.0)
 units               0.8-5       2023-11-28 [1] CRAN (R 4.4.0)
 utf8                1.2.4       2023-10-22 [1] CRAN (R 4.4.0)
 vctrs               0.6.5       2023-12-01 [1] CRAN (R 4.4.0)
 viridisLite         0.4.2       2023-05-02 [1] CRAN (R 4.4.0)
 withr               3.0.0       2024-01-16 [1] CRAN (R 4.4.0)
 wk                  0.9.1       2023-11-29 [1] CRAN (R 4.4.0)
 XML                 3.99-0.16.1 2024-01-22 [1] CRAN (R 4.4.0)

 [1] /Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/library

────────────────────────────────────────
Robinlovelace commented 5 months ago

How were you expecting it to look?

mtennekes commented 5 months ago

How were you expecting it to look?

Ah, we took a look at it again, and it actually does look correct. First I thought there was a shift, but that's because Norway it not part of the EU, neither is the UK ;-)

So false alarm.

Robinlovelace commented 5 months ago

Another disbenefit of Brexit: confusing geo developers :gb: :laughing: