Skip to contents

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

Usage

mapboxgl_view(
  data,
  column = NULL,
  n = NULL,
  style = mapbox_style("light"),
  ...
)

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 Mapbox style to use. Defaults to mapbox_style("light").

...

Additional arguments passed to mapboxgl()

Value

A Mapbox GL map object

Examples

if (FALSE) { # \dontrun{
library(sf)
nc <- st_read(system.file("shape/nc.shp", package = "sf"))

# Basic view
mapboxgl_view(nc)

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

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