Add a data source to a mapgl::maplibre() or mapgl::mapboxgl() map.
Source: R/addSource.R
addSource.RdAdd a data source to a mapgl::maplibre() or mapgl::mapboxgl() map.
Arguments
- map
the
mapgl::maplibre()ormapgl::mapboxgl()map to add the data source to.- id
a unique
IDfor the data source.- data
a
sf,wk,geosorSpatVectorobject.- file
a valid local file path to a
geoarroworgeoparquetfile to be added to the map. Ignored ifdatais supplied.- url
a URL to a remotely hosted
geoarroworgeoparquetfile to be added to the map. Ignored ifdataorfileis supplied.- ...
currently not used.
Details
See geoarrowWidget::attachData() for details.
Examples
library(mapgl)
library(wk)
pt = wkt("POINT (0 0)")
m = maplibre()
m = m |>
addSource(
id = "pt"
, data = pt
) |>
addGeoArrowScatterplotLayer(source = "pt")
## open the map in the browser, press <Ctrl+u> and look for a line like this:
## <link id="pt-geoarrowWidget-attachment" rel="attachment" href="lib/pt-0.0.1/pt.arrow"/>
m