New version of cartography

A new version of the cartography package (v2.4.0) has arrived on CRAN.

New Features

  • waffleLayer() plots a “waffle map”. This kind of representation allows to plot several quantities on the same map.
  • ghostLayer() is a short function that plot an invisible layer with the extent of a spatial object. This function is useful to initiate a map with a specific extent.
library(sf)
library(cartography)
mtq <- st_read(system.file("gpkg/mtq.gpkg",
package="cartography")) target <- mtq[30, ] ghostLayer(target) plot(st_geometry(mtq), col = "gold2", add = TRUE)

These 3 functions are well described by their creator, Diego Hernangómez, on his blog.

Enhancements

getTiles() gets map tiles from various tile servers.

  •  The function has gained caching capacities (through cachedir and forceDownload arguments). Users can now cache tiles in a folder and reuse them across R sessions.
  • More than 50 tile servers have been included and other can be added by users.
  •  It is possible to use Thunderforest tiles with an API key.
click here to see the figure in a better resolution

The barscale() function plots a scale bar on a map, a new unit argument has been added to plot the scale bar in meters, kilometers or miles.

Under the Hood

cartography does not use rosm anymore to import map tiles. The package is working great but its maintainer, Dewey Dunnington, suggests that it will not evolve much and that other package will appear to replace it. Thus we have decided to use slippymath and internal code to download tiles. A (positive) side effect of this replacement is a decrease in the indirect dependancies of cartography.

cartography appears to be robust to the changes introduced by the last sf version (v0.9). This version takes into account the new representation of coordinate reference systems proposed by GDAL and PROJ. More information on this here.


OpenEdition vous propose de citer ce billet de la manière suivante :
Timothée Giraud (3 avril 2020). New version of cartography. R Géomatique. Consulté le 10 octobre 2024 à l’adresse https://doi.org/10.58079/tp4l


Laisser un commentaire

Votre adresse e-mail ne sera pas publiée. Les champs obligatoires sont indiqués avec *

Ce site utilise Akismet pour réduire les indésirables. En savoir plus sur comment les données de vos commentaires sont utilisées.