Initializes a glmap WebGL2 + MapLibre GL interactive map widget.
If data is supplied (sf, sfc, SpatRaster, SpatVector, wk::xy, nanoarrow,
data.frame, or crosstalk::SharedData), glmap() automatically inspects its type
and adds the appropriate GPU layer unless layers are added downstream via pipes (|>).
Arguments
- data
Optional default spatial dataset (
sf,sfc,SpatRaster,data.frame, orSharedData).- basemap
Basemap style name (
"dark","positron","voyager","osm","satellite","none"), a provider from gl_providers, or a custom MapLibre style URL /{z}/{x}/{y}template.- api_key
Optional API key string for the basemap provider (can also be configured globally via
gl_set_api_key()or environment variables such asCARTO_API_KEY,MAPTILER_API_KEY,STADIA_API_KEY).- center
Numeric vector
c(lon, lat)for initial map center. Auto-computed from layers ifNULL.- zoom
Numeric initial zoom level.
- pitch
Numeric initial tilt angle in degrees (
0to85).- bearing
Numeric initial rotation bearing in degrees.
- projection
Map projection:
"mercator"(default) or"globe".- transport
Binary transport mode:
"auto"(inline gzipped binary up to 25 MB, works in static HTML & Viewer),"server"(streams via localhttpuvbinary range server), or"inline".- width
Widget width (CSS units).
- height
Widget height (CSS units).
- elementId
Optional HTML element ID.
- auto_layer
Logical; if
TRUEanddatais provided, automatically adds a default GPU layer when the map is printed/rendered if no explicitadd_*()layers were called.- ...
Additional arguments passed to the default layer when
auto_layer = TRUE.