MyNixOS website logo
Description

Interactive Cartography.

Create a wide range of interactive, zoomable vector maps. This package is an 'R' binding for the 'geoviz' 'JavaScript' library <https://github.com/riatelab/geoviz/>, itself based on the 'd3.js' ecosystem <doi:10.1109/TVCG.2011.185>. Like the original 'JavaScript' library, the package takes advantage of the many features provided by 'd3.js': proportional symbols, pictograms, typologies, choropleth maps, spikes, tiles, Dorling cartograms, and more. It can also be used to create pretty static vectorial maps in 'svg' format, suitable for editorial cartography.

geovizr geovizr logo

geovizr statusbadge Project Status: Active – The project has reached a stable, usablestate and is being activelydeveloped.

Interactive Cartography (htmlwidget)

geovizr is an R package for thematic mapping. It's an R wrapper around the geoviz JavaScript library, itself based on the d3.js ecosystem. Like the original JavaScript library, the package can be used to create a wide range of interactive, zoomable vector maps, taking advantage of d3's many features: proportional symbols, pictograms, typologies, choropleth maps, spikes, tiles, Dorling cartograms, etc. It can also be used to create pretty static vectorial maps in SVG format, suitable for editorial cartography.

Installation

You can install the released version of geovizr from CRAN with:

install.packages("geovizr")

Alternatively, you can install the development version of geovizr from r-universe with:

install.packages("geovizr", repos = c("https://riatelab.r-universe.dev", "https://cloud.r-project.org"))

Usage

Creating a map with geovizr requires chaining several functions. The create() function initializes a map with general parameters. Then, functions such as outline(), graticule(), path(), and many others allow you to add and refine layers. Finally, the render() function displays the map. Here are a few examples.

First, let's load some data

library(sf)
world <- st_read(
  system.file("gpkg/world.gpkg", package = "geovizr"),
  quiet = TRUE
)
  • A simple map
viz_create(projection = "InterruptedMollweide", zoomable = TRUE) |>
  viz_outline() |>
  viz_graticule(stroke = "white") |>
  viz_path(data = world, fill = "#38896F", tip = "$NAMEen") |>
  viz_render()
simple map
  • Proportional symbol
viz_create(projection = "InterruptedMollweide", zoomable = TRUE) |>
  viz_outline() |>
  viz_graticule(stroke = "white") |>
  viz_path(data = world, fill = "#CCC") |>
  viz_prop(data = world, var = "pop", fill = "#38896F",
           leg_pos = c(60, 300),  
           leg_values_factor = 1/1000000,
           leg_values_round = 0,
           leg_title  = "Population",
           leg_subtitle = "(million inh.)"
           ) |>
  viz_render()
prop map
  • Choropleth
viz_create(projection = "InterruptedMollweide", zoomable = TRUE) |>
  viz_outline() |>
  viz_graticule(stroke = "white") |>
  viz_path(data = world, fill = "#CCC") |>
  viz_choro(data = world, var = "gdppc",
            colors = "Peach",
            leg_title  = "GDP per capita",
            leg_subtitle = "(in $)",
            leg_values_round = 0,
            leg_pos = c(60, 300)
            ) |>
  viz_render()
choro map

Alternatives

geovizr is not intended to compete with other mapping packages in R, such as mapsf or tmap. It really focuses on the html / interactive geovisualisation.

Community Guidelines

One can contribute to the package through pull requests and report issues or ask questions here.

Metadata

Version

1.0.0

License

Unknown

Platforms (79)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    uefi
    wasip1
    Windows
Show all
  • aarch64-darwin
  • aarch64-freebsd
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64-uefi
  • aarch64-windows
  • aarch64_be-none
  • arc-linux
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-linux
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • sh4-linux
  • vc4-none
  • wasm32-wasip1
  • wasm64-wasip1
  • x86_64-cygwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-uefi
  • x86_64-windows