[R-sig-Geo] viewing locally hosted mbtiles vector tiles using leaflet.mapboxgl?
nevil amos
nev||@@mo@ @end|ng |rom gm@||@com
Wed Mar 11 02:59:19 CET 2020
I am working on a shiny/ leaflet map project which requires display of a
large polygon dataset (40,000 polygons ~92MB sf object).
Needless to say it take quite a time to render the sf object and zoom in
and out.
Simplifying the polygons is not an option.
leaflet.mapboxgl https://github.com/rstudio/leaflet.mapboxgl package
allows adding of Mapbox GL layers to a leaflet map.
Since I am using my own local tiles there should be no need for a maxbox
access token.
If possible I would like to make use of leaflet.mapboxgl: addMapboxGL() to
display vector tiles ( as .mbtiles) of the polygons that have been pre-
rendered from the polygon dataset using tippecanoe
https://github.com/mapbox/tippecanoe and served using mbtileserver
https://github.com/consbio/mbtileserver all on the same local machine.
mbtileserver is running from the project directory, and the mbtiles are in
the path: <R project directory>/tilesets/mytiles.mbtiles
I can vie the preview in the bowser a
http://localhost:8000/services/myTiles/map
however the polygons do not dispay in leaflet in r
As this requires use of tippecanoe and mbtileserver I cannot post a repro,
however below is a pared down version fo the code I am using :
library(leaflet)
library(leaflet.mapboxgl)
options(mapbox.accessToken=NA)
base_map <- leaflet() %>%
setView(lng = 145,lat = -37,zoom = 7)%>%
addProviderTiles("Esri.WorldTopoMap", group = "ESRI Topo") %>%
addMapox http://localhost:8000/services/myTiles ")
have I simply got the wrong format/ incomplete URL fo the addMapboxGL ? If
so what should it be?
thanks
[[alternative HTML version deleted]]
More information about the R-sig-Geo
mailing list