SymbolixAU / mapdeck

R interface to Deck.gl and Mapbox

Home Page:https://symbolixau.github.io/mapdeck/articles/mapdeck.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Custom tile layer (slippy map)

ratnanil opened this issue · comments

commented

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.

commented

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

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
)
commented

@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
)