writeMap: Export and display the map

View source: R/writemap.R

writeMapR Documentation

Export and display the map


This function combines all the elements specified by the user and write the corresponding HTML and Javascript code in a local directory.


  dir = getwd(),
  prefix = "",
  width = 700,
  height = 400,
  setView = NULL,
  setZoom = NULL,
  interface = NULL,
  lightjson = FALSE,
  directView = c("viewer", "browser", "disabled"),
  leaflet.loc = "online",
  popup.style = NULL



basemap and spl objects to embed into the map


a character string giving the directory path to export the map. Default is the working directory.


a character string to add a prefix to file names. This allows multiple exportations in the same directory.

width, height

the width and height of the map, in pixels.


a numeric vector of the form c(x, y) setting the initial geographical center of the map.


a numeric value setting the initial map zoom.


an ui object created with ui to customize the interface controls.


logical. Should GeoJSON files size be reducedby supressing extra whitespace characters and rounding numeric values? Default is FALSE. This is currently not compatible with RMarkdown popups.


a character string indicating if and how should the map be displayed. Default option "viewer" uses (if available) the RStudio HTML viewer to display the map, "browser" opens the map into the web browser and "disabled" disables direct display.


a character string specifying the location (directory) of the leaflet library. If set to "online" (default), the library is loaded from the leaflet official CDN and requires an internet connection.


an optional character string of CSS to customize popups content properties (width, color, etc).

rleafmap documentation built on Oct. 20, 2023, 5:08 p.m.