SymbolixAU / mapdeck

R interface to Deck.gl and Mapbox
https://symbolixau.github.io/mapdeck/articles/mapdeck.html
362 stars 40 forks source link

Custom tile layer (slippy map) #365

Open ratnanil opened 1 year ago

ratnanil commented 1 year ago

Is there a way to use custom base maps with mapdeck? I'm thinking along the lines of the OSM slippy maps. There is something on this topic on deck.gl.

dcooley commented 1 year ago

This is not currently possible. I keep intending to look into this but just don't have the time. If you know of a solution I'll happily accept a PR

kmcd39 commented 4 months ago

I got mapdeck working with .json files that specify basemap layers. And you can change the .json to customize the tile layers. Below will also work if you save the .json and modify it locally.

Example below, drawing on carto's base layers

library(mapdeck)
library(jsonlite)

style.pth <- "https://raw.githubusercontent.com/CartoDB/basemap-styles/master/mapboxgl/dark-matter-nolabels.json"

style.json <- jsonlite::read_json(style.pth)

mapdeck::mapdeck(
  style = style.json
  #"https://basemaps.cartocdn.com/gl/dark-matter-gl-style/style.json"
  ,location = c(-73.9165, 40.7514)
  ,zoom = 10
)
dcooley commented 4 months ago

@kmcd39 you don't need the jsonlite::read_json() step, the style argument will accept the URL as input:

mapdeck::mapdeck(
    style = style.pth
    ,location = c(-73.9165, 40.7514)
    ,zoom = 10
)