Skip to content

Commit

Permalink
cleaned code
Browse files Browse the repository at this point in the history
  • Loading branch information
mtennekes committed Jan 28, 2024
1 parent 2126a9e commit f76e8ca
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 6 deletions.
5 changes: 0 additions & 5 deletions R/tmapShape.R
Original file line number Diff line number Diff line change
Expand Up @@ -266,13 +266,8 @@ tmapShape.stars = function(shp, is.main, crs, bbox, unit, filter, shp_name, smet
attr(shp3, "dimensions")[[rst$dimensions[2]]]$values = 1L:ncol(shp)
attr(attr(shp3, "dimensions"), "raster")$curvilinear = FALSE
} else {
#shp2 = stars::st_set_dimensions(shp, rst$dimensions[1], values = {if (dimsxy[[1]]$delta > 0) 1L:nrow(shp) else nrow(shp):1L})
#shp3 = stars::st_set_dimensions(shp2, rst$dimensions[2], values = {if (dimsxy[[2]]$delta < 0) 1L:ncol(shp2) else ncol(shp2):1L})

shp2 = stars::st_set_dimensions(shp, rst$dimensions[1], values = 1L:nrow(shp))
shp3 = stars::st_set_dimensions(shp2, rst$dimensions[2], values = 1L:ncol(shp))

#shp3 = shp
}


Expand Down
21 changes: 20 additions & 1 deletion sandbox/issues.R
Original file line number Diff line number Diff line change
Expand Up @@ -292,16 +292,35 @@ reprex::reprex({

# 818

reprex::reprex({
library(stars)
library(mapview)
m = matrix(1:20, 4)
s0 = st_as_stars(m)
s = s0
st_crs(s) <- 4326
st_crs(s0) <- 4326

st_geotransform(s0) <- c(5, 1.5, 0.2, 0, 0.2, 1.5)

s0_4326 = st_transform(s0, crs = 4326)

stars:::is_curvilinear(s0)
stars:::is_curvilinear(s0_4326)

s0
s0_4326
})




d = st_dimensions(s0)
has_raster(s0) && isTRUE(attr(s0, "raster")$curvilinear)





library(tmap)
tmap_mode("plot")
tmap_mode("view")
Expand Down

0 comments on commit f76e8ca

Please sign in to comment.