The seconfd raster is not displayed the first time.
library(sf)
#> Linking to GEOS 3.13.1, GDAL 3.10.3, PROJ 9.6.0; sf_use_s2() is TRUE
lon1 <- c(2.653112, 2.685471, 2.685471, 2.653112, 2.653112)
lat1 <- c(42.427891, 42.427891, 42.442018, 42.442018, 42.427891)
lon2 <- c(1.267462, 1.309733, 1.309733, 1.267462, 1.267462)
lat2 <- c(44.469653, 44.469653, 44.490566, 44.490566, 44.469653)
bb1 <- st_sfc(st_polygon(list(cbind(lon1, lat1))))
bb1 <- st_as_sf(bb1)
st_crs(bb1) <- 4326
bb2 <- st_sfc(st_polygon(list(cbind(lon2, lat2))))
bb2 <- st_as_sf(bb2)
st_crs(bb2) <- 4326
library(elevatr)
#> elevatr v0.99.0 NOTE: Version 0.99.0 of 'elevatr' uses 'sf' and 'terra'. Use
#> of the 'sp', 'raster', and underlying 'rgdal' packages by 'elevatr' is being
#> deprecated; however, get_elev_raster continues to return a RasterLayer. This
#> will be dropped in future versions, so please plan accordingly.
rast1 <- get_elev_raster(locations = bb1, z = 12, prj = 4326)
#> Mosaicing & Projecting
#> Note: Elevation units are in meters.
rast1 <- as(rast1, "SpatRaster")
rast2 <- get_elev_raster(locations = bb2, z = 12, prj = 4326)
#> Mosaicing & Projecting
#> Note: Elevation units are in meters.
rast2 <- as(rast2, "SpatRaster")
# plot
library(mapsf)
mf_raster(rast1)

mf_raster(rast2)
#> Warning in mean.default(out$ext[3:4]): argument is not numeric or logical:
#> returning NA


Created on 2026-07-15 with reprex v2.1.1
The seconfd raster is not displayed the first time.
mf_raster(rast2)Created on 2026-07-15 with reprex v2.1.1