maplibre_view: Quick visualization of geometries with MapLibre GL

View source: R/quickview.R

maplibre_viewR Documentation

Quick visualization of geometries with MapLibre GL

Description

This function provides a quick way to visualize sf geometries using MapLibre GL JS. It automatically detects the geometry type and applies appropriate styling.

Usage

maplibre_view(
  data,
  column = NULL,
  n = NULL,
  style = carto_style("positron"),
  ...
)

Arguments

data

An sf object to visualize

column

The name of the column to visualize. If NULL (default), geometries are shown with default styling.

n

Number of quantile breaks for numeric columns. If specified, uses step_expr() instead of interpolate().

style

The MapLibre style to use. Defaults to carto_style("positron").

...

Additional arguments passed to maplibre()

Value

A MapLibre GL map object

Examples

## Not run: 
library(sf)
nc <- st_read(system.file("shape/nc.shp", package = "sf"))

# Basic view
maplibre_view(nc)

# View with column visualization
maplibre_view(nc, column = "AREA")

# View with quantile breaks
maplibre_view(nc, column = "AREA", n = 5)

## End(Not run)

mapgl documentation built on June 8, 2025, 1:57 p.m.