Skip to content

Commit

Permalink
...
Browse files Browse the repository at this point in the history
  • Loading branch information
mtennekes committed Feb 1, 2024
1 parent 43e49d7 commit 018615d
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 2 deletions.
10 changes: 9 additions & 1 deletion R/step1_helper_facets.R
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ get_split_stars_dim = function(lst) {
# ## estimate number of facets
step1_rearrange_facets = function(tmo, o) {
#o = tmap_options_mode()
dev = getOption("tmap.devel.mode")


# get the final tm_faets object (ignoring group specific args: is.wrap, by, rows, columns, pages)
Expand All @@ -61,6 +62,9 @@ step1_rearrange_facets = function(tmo, o) {
shp = tmg$tms$shp
smeta = tmapGetShapeMeta1(shp, c(o, tmg$tmf))

if (dev) timing_add(s3 = "get_shape_meta1")


assign("vl", NULL, envir = .TMAP)
assign("vn", 1L, envir = .TMAP)

Expand Down Expand Up @@ -188,6 +192,8 @@ step1_rearrange_facets = function(tmo, o) {
shp = tmapSplitShp(shp, split_stars_dim)
if (split_stars_dim != "") {
smeta = tmapGetShapeMeta1(shp, o)
if (dev) timing_add(s3 = "get_shape_meta1_2")

}


Expand Down Expand Up @@ -294,8 +300,10 @@ step1_rearrange_facets = function(tmo, o) {

smeta$vars = get("used_vars", envir = .TMAP)
shp = tmapSubsetShp(shp, smeta$vars)

if (dev) timing_add(s3 = "subset_shp")

smeta = tmapGetShapeMeta2(shp, smeta, c(o, tmg$tmf))
if (dev) timing_add(s3 = "get_shape_meta2")



Expand Down
41 changes: 40 additions & 1 deletion sandbox/issues.R
Original file line number Diff line number Diff line change
Expand Up @@ -445,4 +445,43 @@ tm_shape(nc.32119) + tm_polygons(c("SID74", "SID79"), fill.free = FALSE, fill.le
tm_facets()


##
##

library(terra)
library(tmap)
lc = rast("https://osf.io/download/m92d7")

system.time({plot(lc)})

summaryRprof()
Rprof(tmp <- tempfile())
print(tm_shape(lc) +
tm_raster())
Rprof()
summaryRprof(tmp)
unlink(tmp)

World$well_being_rounded = round(World$well_being)
tm_shape(World) + tm_polygons("HPI") + tm_facets(by = "well_being_rounded")

## maptiles leaflet inconsistancy (will be solved in maptiles)

reprex::reprex({
library(maptiles)
library(leaflet)
a = names(maptiles:::maptiles_providers)
b = names(leaflet::providers)

a
b
setdiff(a, b)
})


ttm()
tm_basemap(c("Esri.WorldShadedRelief", "Stadia.StamenTerrain")) +
tm_tiles("Stadia.StamenTerrainLines") +
tm_tiles("Stadia.StamenTerrainLabels")



0 comments on commit 018615d

Please sign in to comment.