% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/deckgl.R
\name{deckgl}
\alias{deckgl}
\title{Render a Deck.gl visualization}
\usage{
deckgl(
  spec,
  specType = c("auto", "json", "yaml"),
  data = NULL,
  con = NULL,
  data_transport = c("auto", "file", "inline"),
  data_dir = NULL,
  width = NULL,
  height = NULL
)
}
\arguments{
\item{spec}{Deck.gl specification as an R list, JSON text, JSON file path,
YAML text, or YAML file path.}

\item{specType}{One of "auto" (default), "json", or "yaml". Auto-detection
attempts to infer the format from the input.}

\item{data}{Named list of data.frames to register in DuckDB. These tables
can be referenced in the spec using `type = "duckdb"` data nodes.}

\item{con}{Optional DuckDB connection to use for queries. If provided,
this connection will be used instead of creating a new one.
This is useful for GeoArrow workflows where you need spatial
extension and geometry tables already set up.}

\item{data_transport}{How hydrated Arrow/Parquet query results are delivered
to the browser. `"auto"` uses `"file"` when `data_dir` is
supplied and otherwise falls back to `"inline"` for portable
widgets; `"inline"` embeds base64 payloads in the widget;
`"file"` writes binary files to `data_dir` and uses relative
URLs.}

\item{data_dir}{Directory for `"file"` transport. Serve or save the widget
from the same directory so relative URLs resolve.}

\item{width}{CSS or pixel width (e.g. "100\%", "600px", or numeric).}

\item{height}{CSS or pixel height (e.g. "100\%", "600px", or numeric).}
}
\value{
An htmlwidget that renders the Deck.gl visualization.
}
\description{
Creates an interactive deck.gl visualization from a JSON or YAML specification.
Supports server-side data hydration via DuckDB for efficient data handling.
}
\examples{
if (interactive()) {
  # Simple scatterplot with inline data
  spec <- list(
    `@type` = "DeckGL",
    initialViewState = list(
      longitude = -122.4,
      latitude = 37.76,
      zoom = 12,
      pitch = 0,
      bearing = 0
    ),
    layers = list(
      list(
        `@type` = "ScatterplotLayer",
        id = "scatterplot",
        data = list(
          type = "duckdb",
          query = "SELECT lon, lat, radius FROM points"
        ),
        getPosition = "@=[lon, lat]",
        getRadius = "@=radius",
        getFillColor = c(255, 0, 0)
      )
    )
  )

  data <- list(
    points = data.frame(
      lon = c(-122.4, -122.45, -122.35),
      lat = c(37.76, 37.78, 37.74),
      radius = c(100, 150, 200)
    )
  )

  deckgl(spec = spec, data = data)
}

}
