r-tmap/tmap

Example error v3

olivroy opened this issue · 8 comments

tm_shape(World) + tm_polygons(col = "economy", style = "cat")
#> Erreur in if ("col" %in% names(args_called) && (!args$called_from %in%  : 
  missing value where TRUE / FALSE is required.

v3 result
image

@mtennekes

Not sure.. but there is a vignette that stopped rendering.. Is it because of that new commit?

devtools::load_all()
#> ℹ Loading tmap
tm_shape(World, crs = 8857) +
    tm_cartogram(size = "pop_est", fill = "income_grp")
#> Warning in CPL_crs_from_input(x): GDAL Error 1: PROJ:
#> proj_create_from_database: Cannot find proj.db
#> Error: crs not found: is it missing?

Created on 2024-05-08 with reprex v2.1.0

I can't reproduce the CI failure locally..

But somehow, this map produces error on CI

tm_shape(World, bbox = sf::st_bbox(c(xmin = -180, xmax = 180, ymin = -86, ymax = 86))) +
	tm_polygons(fill = NA, col = "black") +
tm_shape(metro) +
	tm_symbols(size = 0.1, col = "red") +
tm_layout(inner.margins = rep(0, 4))
#> ! LOGICAL() can only be applied to a 'logical', not a 'NULL'

Don't know how to traceback that issue if I can't reproduce it.

The first warning/error seems like an installation error in GDAL.
Could you test this code on CI:

data(World, package = "tmap")
library(sf)
World8857 = st_transform(World, crs = 8857)

Could you also enable run tmap_devel_mode() after loading the package? And share the results.

Disregard the first error, it was a config issue on my old computer

I was able to reproduce with

build_rmd("vignettes/tmap_vv.Rmd")
.Last.error

Interactively, I get with devel_mode

                s1                 s2                      s3                     s4 total
            <char>             <char>                  <char>                 <char> <num>
 1:                                                                                  0.000
 2:                                   get_shape_meta1 (0.383)                        0.383
 3:                                        subset_shp (0.002)                        0.385
 4:                                   get_shape_meta2 (0.001)                        0.386
 5:                                   get_shape_meta1 (0.001)                        0.387
 6:                                        subset_shp (0.041)                        0.428
 7:                                   get_shape_meta2 (0.001)                        0.429
 8:                facet meta (0.451)                                                0.451
 9:                prep shape (0.005)                                                0.456
10: step 1 (0.457)                                                                   0.457
11:                                                                 aes fill (0.094) 0.551
12:                                                                  aes col (0.005) 0.556
13:                                                                  aes lwd (0.005) 0.561
14:                                                                  aes lty (0.005) 0.566
15:                                                           aes fill_alpha (0.004) 0.570
16:                                                            aes col_alpha (0.005) 0.575
17:                                                                  combine (0.007) 0.582
18:                                    layer polygons (0.126)                        0.583
19:                     group (0.130)                                                0.587
20:                                                                 aes size (0.004) 0.591
21:                                                                 aes fill (0.006) 0.597
22:                                                                  aes col (0.005) 0.602
23:                                                                aes shape (0.005) 0.607
24:                                                                  aes lwd (0.005) 0.612
25:                                                                  aes lty (0.006) 0.618
26:                                                           aes fill_alpha (0.005) 0.623
27:                                                            aes col_alpha (0.005) 0.628
28:                                                                  combine (0.011) 0.639
29:                                     layer symbols (0.053)                        0.640
30:                     group (0.054)                                                0.641
31: step 2 (0.185)                                                                   0.642
32: step 3 (0.033)                                                                   0.675
33: step 4 (1.258)                                                                   1.933
                s1                 s2                      s3                     s4 total

tmap_devel_mode() doesn't show anything if an error occurs. For now, the workaround will be to avoid the basemap? Opened #875 for now!

If this bug is caused by 749128c then something is wrong with the interpolation (#873).

If so, 81f217a should (temporarily) solve it. However, the strange this is that this 'interpolation' option (that is passed on to grid::rasterGrob was also used in v3.

still not working :( have you had a chance to dig it more?

the main problem is that it is harder to see if a fix breaks something elsee I can retry to look at this if you can't find what the issue is..

Found the issue! Will solve it later.

Feel free to reopen if needed again