mapsf icon indicating copy to clipboard operation
mapsf copied to clipboard

Enrich mf_background() with css like features

Open rCarto opened this issue 4 years ago • 2 comments

mf_background() adds background images underneath maps:

library(mapsf)
#> Le chargement a nécessité le package : sf
#> Linking to GEOS 3.7.1, GDAL 3.1.2, PROJ 7.1.0
mtq <- mf_get_mtq()
th <- mf_theme("default", bg = "grey20", fg = "grey80")
mf_init(mtq, theme = th)
mf_background(system.file("img/background.jpg", package = "mapsf"))
mf_map(mtq, lwd = 2, col = NA, border = "grey80", add = TRUE)
mf_title("A map with a nice background")

Created on 2021-06-18 by the reprex package (v2.0.0)

For now the image is stretched to fill the map space. I think it could be nice to mimic some CSS background features in this function. See https://www.w3schools.com/cssref/css3_pr_background-size.asp and https://www.w3schools.com/cssref/pr_background-repeat.asp.

The idea is to add some of these features to the function: mf_background(filename = "xxx.png", size = "cover", repeat = FALSE)

Feel free to get in touch if you want to contribute.

rCarto avatar Jun 18 '21 14:06 rCarto

I would like to work on this Can you assign me this

zatch3301 avatar Jul 07 '21 20:07 zatch3301

Yes, sure! Thank you.

rCarto avatar Jul 08 '21 07:07 rCarto