Timothée Giraud, Nicolas Lambert


1 Introduction

The aim of cartography is to obtain thematic maps with the visual quality of those build with a classical mapping or GIS software.

Users of the package could belong to one of two categories: cartographers willing to use R or R users willing to create maps. Therefore, its functions have to be intuitive to cartographers and ensure compatibility with common R workflows.

cartography uses sf or sp objects to produce base graphics. As most of the internals of the package relies on sf functionalities, the preferred format for spatial objects is sf.

2 Features

cartography’s functions can be classified in the following categories :

3 Examples of thematic maps

3.1 Proportional Symbols

propSymbolsLayer() displays symbols with areas proportional to a quantitative variable (stocks). Several symbols are available (circles, squares, bars). The inches argument is used to customize the symbols sizes.

3.2 Choropleth Map

In choropleth maps, areas are shaded according to the variation of a quantitative variable. They are used to represent ratios or indices.

choroLayer() displays choropleth maps . Arguments nclass, method and breaks allow to customize the variable classification. getBreaks() allow to classify outside of the function itself. Colors palettes are defined with col and a set of colors can be created with carto.pal() (see also display.carto.all()).

3.3 Colored Pencil and Typologies Map

getPencilLayer() transforms POLYGONS or MULTIPOLYGONS in MULTILINESTRINGS. This function creates a layer that mimicks a pencil hand-drawing.

typoLayer() displays a typology map of a qualitative variable. legend.values.order is used to set the modalities order in the legend.

3.4 Proportional Symbols and Choropleth Map

propSymbolsChoroLayer() creates a map of symbols that are proportional to values of a first variable and colored to reflect the classification of a second variable. A combination of propSymbolsLayer() and choroLayer() arguments is used.

3.5 Proportional Symbols and Typology Map

propSymbolsTypoLayer() creates a map of symbols that are proportional to values of a first variable and colored to reflect the modalities of a second qualitatice variable. A combination of propSymbolsLayer() and typoLayer() arguments is used.

3.6 Label Map

labelLayer() is dedicated to the display of labels on a map. The overlap = FALSE argument displays non overlapping labels.

3.8 Isopleth Map

Isopleth maps are based on the assumption that the phenomenon to be represented has a continuous distribution. These maps use a spatial interaction modeling approach which aims to compute indicators based on stock values weighted by distance. It allows a spatial representation of the phenomenon independent from the initial heterogeneity of the territorial division.
smoothLayer() heavily depends on the SpatialPosition package. The function uses a marked point layer and a set of parameters (a spatial interaction function and its parameters) and displays an isopleth map layer.

3.9 Grid Map

The grid-cell method is an option to overcome the arbitrariness and irregularity of an administrative division. It highlights the main trends in the data spatial distribution, splitting the territory in regular blocks. Statistical values are distributed over a regular grid. Cell values are classified and then displayed in areas of color. The principle adopted here is to set each cell’s value with a proportion of the initial geometrical units it overlay (share of intersected area).
getGridLayer() builds a regular grid (squares or hexagons) based on a spatial object and computes data that match the grid layer. choroLayer() is then used to display the grid on a choropleth map.

3.10 Discontinuities Map

Discontinuities maps are based on the variation of a phenomena between contiguous units. This kind of representation focuses spatial breaks. The discontinuity intensity is expressed by the borders’ thickness.
getBorders() is used to build a spatial object of borders between units. Each resulting borders contains the ids of its two neighboring units. It is possible to complement these borders with getOuterBorders() to compute borders between non-contiguous units (e.g. maritime borders). discLayer() computes and displays discontinuities, lines widths reflect the ratio or the absolute difference between values of an indicator in two neighboring units.

3.11 Mapping sp Objects

SpatialPointsDataFrame and SpatialPolygonsDataFrame (from sp) are handled through the spdf argument if the variable is contained within the Spatial*DataFrame and through spdf, spdfid, df, dfid if the variable is in a separate data.frame that needs to be joined to the Spatial*DataFrame.

4 Datasets

Several datasets are embedded in the package: