Skip to content

Commit 62e96ba

Browse files
committed
fixed issues related to polygons_3d
1 parent 1aa253a commit 62e96ba

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

R/tm_crs.R

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,13 @@ tm_crs = function(crs = NA, property = NA, bbox = NULL) {
3838

3939
consider_global = function(x, th = 0.6) {
4040
b = sf::st_bbox(x)
41+
# in case margins are applied
42+
if (sf::st_is_longlat(b)) {
43+
b["xmin"] = max(b["xmin"], -180)
44+
b["xmax"] = min(b["xmax"], 180)
45+
b["ymin"] = max(b["ymin"], -90)
46+
b["ymax"] = min(b["ymax"], 90)
47+
}
4148
if (b$xmin == b$xmax || b$ymin == b$ymax) return(FALSE)
4249
earth_surface = 5.1e14
4350
area = b |>

R/tmapTrans.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -246,9 +246,9 @@ tmapTransRaster = function(shpTM, ord__, plot.order, args) {
246246
tmapTransPolygons = function(shpTM, ord__, plot.order, args, scale) {
247247
within(shpTM, {
248248
is_stars = inherits(shp, "dimensions")
249-
if (is_stars && args$polygons.only == "no") {
249+
if (is_stars && args$polygons.only != "yes") {
250250
### stars
251-
s = structure(list(values = matrix(TRUE, nrow = nrow(shp))), dimensions = shp, class = "stars")
251+
s = structure(list(values = matrix(TRUE, nrow = nrow(shp), ncol = ncol(shp))), dimensions = shp, class = "stars")
252252
shp = sf::st_as_sfc(s, as_points = FALSE)
253253
} else if (is_stars) {
254254
shp = sf::st_sfc()

0 commit comments

Comments
 (0)