Skip to contents

Creates an htmlwidget that embeds the GeoLibre geographic information system. The widget carries a .geolibre.json project, which the add_*(), set_*(), and control functions build up with the pipe.

Usage

geolibre(
  project = NULL,
  center = NULL,
  zoom = NULL,
  basemap = NULL,
  name = "Untitled Project",
  width = NULL,
  height = NULL,
  app_url = getOption("geolibre.app_url", "https://web.geolibre.app/"),
  layout = c("embed", "full", "maponly"),
  theme = c("light", "dark"),
  map_only = FALSE,
  elementId = NULL,
  panels = c("expanded", "collapsed", "hidden")
)

Arguments

project

A GeoLibre project list, a path to a .geolibre.json file, or NULL for a new project.

center

Optional initial c(longitude, latitude) map center.

zoom

Optional initial zoom level.

basemap

Optional basemap name from basemaps() or a MapLibre style JSON URL. Ignored when project is supplied, which carries its own.

name

Project name recorded in the project file.

width, height

Widget dimensions passed to htmlwidgets::createWidget().

app_url

URL of a GeoLibre web deployment. It must support the ?embed=1 project bridge.

layout

Application chrome to show: "embed" (compact controls), "full" (the complete desktop interface), or "maponly" (map only).

theme

Application theme, "light" or "dark".

map_only

Deprecated. TRUE is equivalent to layout = "maponly".

elementId

Optional widget element ID.

panels

Initial side-panel state: "expanded", "collapsed" (icon rails remain available), or "hidden".

Value

An htmlwidget that can be modified with add_*() functions.

Details

The default hosted application requires internet access when the widget is displayed. Package installation, project construction, and file operations do not contact it. Set app_url or the geolibre.app_url option to use a self-hosted deployment.

Examples

map <- geolibre(center = c(-77.0369, 38.9072), zoom = 10, layout = "maponly")
stopifnot(inherits(map, "geolibre"))

# A dark-themed map with the full application interface.
geolibre(basemap = "dark", layout = "full")