knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.width=6, fig.height=4 )
First, we import the advancedtissot package. Then, we import the rnaturalearth package to retrieve geometries of country boundaries, which we use as examples.
library(advancedtissot) library(rnaturalearth)
It is recommended to use advancedtissot library in combination with package sf, as returned data are sf-objects.
library(sf)
Retrieve data for various countries and the world from rnaturalearth.
world <- ne_countries(returnclass = "sf") norway <- ne_countries(country="norway",returnclass = "sf") antarctica <- ne_countries(country="antarctica",returnclass = "sf") kenya <- ne_countries(country="kenya",returnclass = "sf")
The output below is view of the world with distortions in plate carree projection.
tissot_world <- tissot(world) plot(tissot_world)
Using the optional crs parameter in the plot function, the user can see the input geometries as well as the indicatrix in a different map projection. The output below is view of the world with distortions in equal area Mollweide projection.
plot(tissot_world, crs = "+proj=moll +lon_0=0 +x_0=0 +y_0=0 +ellps=WGS84 +datum=WGS84 +units=m no_defs")
The output below is view of the world with distortions in Web Mercator projection, which has massive area distortions towards the poles. Note, that the percentage, by which the area changes at a specific location, can be visualized using the areachange parameter.
plot(tissot_world, crs = 3857, areachange = TRUE)
The automatic circle density distribution is not ideal for this region. Therefore we specify it manually through circles_den parameter.
tissot_antarctica <- tissot(antarctica, circles_den = c(15, 5)) plot(tissot_antarctica)
The output for stereographic polar projection on Antarctica looks like this: We can visualize the percentage of area change with the areachange parameter set to TRUE.
plot(tissot_antarctica, crs = 3031, areachange = TRUE)
For Kenya, the automatically generated circles are a too many on the plot and they can be downsized.
tissot_kenya <- tissot(kenya) plot(tissot_kenya)
Downsizing the circles through cricle_size parameter, this specifies the circle radius in meters: Note. Kenya is around the equator hence area distortion is very small.
tissot_kenya <- tissot(kenya, circles_den = c(5,9), circle_size = 20000) plot(tissot_kenya, areachange = TRUE)
For Norway, the automatic circles look great and you can clearly see the distortion of shape as one moves northwards.
tissot_norway <- tissot(norway) plot(tissot_norway)
General information about tissot object can be obtained through "summary" and "print" functions.
summary(tissot_world) print(tissot_world)
We can obtain input geometries and indicatrix circles as sf objects through "get_geometry" and "get_indicatrix" functions.
get_geometry(tissot_world) get_indicatrix(tissot_world)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.