
Start a MapLibre GL map on a named basemap, fitted to the data
Source:R/gq_mapgl_basemap.R
gq_mapgl_basemap.RdThe first call of a gq web map: mapgl::maplibre() on one of five keyless
basemaps, its view fitted to x. The layers go on with
gq_mapgl_network() and gq_mapgl_layer(), and the switches with
gq_mapgl_controls().
Usage
gq_mapgl_basemap(
x,
basemap = c("voyager", "positron", "openfreemap", "esri_topo", "esri_satellite"),
digits = 5L
)Arguments
- x
The extent to fit: an
sforsfcin any CRS, or ansf::st_bbox(). Its coordinates are taken to EPSG:4326 and rounded todigitsdecimal places, asgq_mapgl_layer()rounds the layers, so the view fits exactly what is drawn.- basemap
"voyager"(Carto Voyager),"positron"(Carto Positron, pale grey),"openfreemap"(OpenFreeMap Liberty),"esri_topo"(Esri World Topographic Map raster tiles) or"esri_satellite"(Esri World Imagery raster tiles, the registry'sesri_satellite).- digits
Decimal places kept in the coordinates; 5 is about 1 m.
Details
Esri's World Topographic Map and World Imagery need no key, and Esri allows free noncommercial use with attribution, which the map shows: the service's own credit, after "Powered by Esri".
Examples
m <- gq_mapgl_basemap(neexdzii_wsd, basemap = "positron")
class(m)
#> [1] "maplibregl" "htmlwidget"
m$x$additional_params$bounds
#> [1] -126.49395 54.49313 -126.11216 54.66072