Une nouvelle version de mapsf est sortie sur le CRAN cette semaine.
Cette nouvelle version utilise le tout nouveau package maplegend pour afficher les légendes.
Une nouvelle fonction mf_distr() a été ajoutée pour afficher des distribution univariée et aider les utilisateurs dans le choix d’une méthode de discrétisation.
mapsf helps to design various cartographic representations such as proportional symbols, choropleth or typology maps. It also offers several functions to display layout elements that improve the graphic presentation of maps (e.g. scale bar, north arrow, title, labels). mapsf maps sf objects on base graphics.
To create maps from tiles, maptiles downloads, composes and displays tiles from a large number of providers (e.g. OpenStreetMap, Stamen, Esri, CARTO, or Thunderforest).
Installation
You can install the released version of maptiles from CRAN with:
install.packages("maptiles")
You can install the development version of maptiles from GitHub with:
maptiles gives access to a lot of tiles servers, but it is possible to add others. The following example demonstrates the setting of a map tiles server and how to cache the original tiles for future use:
The following figure shows mini maps for most of the tiles providers available:
Attribution of map tiles
All maps available through maptiles are offered freely by various providers. The only counterpart from the user is to properly display an attribution text on the maps. get_credit() displays a short credit text to add on each map using the downloaded tiles.
Background
Most of maptilescode comes from getTiles() and tilesLayer() functions in cartography. It appears useful to me to have a package focused on the download and display of map tiles only. On the technical side, it uses terra instead of raster for managing raster data.
Alternatives
There are many alternative packages that pursue the same objective as maptiles. Some focus on a specific map tiles provider (e.g. mapbox, google, OpenStreetMap) or on a specific graphics device (ggplot2). The goal of maptiles is to be flexible enough to allow the use of different providers and to have a minimal number of robust and modern dependencies. However, depending on the use case, one of following packages may better suit your needs:
Not to be confused with tilemaps, that “implements an algorithm for generating maps, known as tile maps, in which each region is represented by a single tile of the same shape and size.”
In cartography several functions have a pos or legend.pos argument. These arguments can take the following values: “topleft”, “top”, “topright”, “right”, “bottomright”, “bottom”, “bottomleft”, “bottomleftextra”, “left” or a vector of two coordinates in map units (c(x, y)).