rdeck icon indicating copy to clipboard operation
rdeck copied to clipboard

Support non-mapbox basemap layers

Open JosiahParry opened this issue 1 year ago • 5 comments

I've tried exploring rdeck but right way I noticed that it doesn't have any base map support with free tiers. For example openlayers or maplibre are not supported. I don't want to give my credit card to mapbox in order to create an account! 🙈

It would be great if the package supported other basemaps. https://deck.gl/docs/get-started/using-with-map

JosiahParry avatar May 20 '24 20:05 JosiahParry

I know that in deck.gl in JavaScript you can skip the basemap and use a WMS (or similar) tile server output as a feature layer. This allows you to make maps without a map box token. Would be awesome if rdeck similarly allowed you to not include the basemap and exposed WMSLayer or similar.

Here's an example JavaScript map.

https://github.com/visgl/deck.gl/blob/9.0-release/examples%2Fwebsite%2Fwms%2Fapp.tsx

jaredlander avatar May 24 '24 01:05 jaredlander

Basemaps without a token can currently only be achieved with raster tiles, using the tile_layer.

Maplibre support is planned #119 and should be simple. WMSLayer support will come with deck.gl v9 (also planned)

anthonynorth avatar May 27 '24 08:05 anthonynorth

So with V9 could we skip the basemap altogether and just use WMSLayer?

jaredlander avatar May 27 '24 13:05 jaredlander

Yes. The basemap doesn't render if map_style = NULL, so you can do

# no basemap
rdeck(map_style = NULL) |>
  add_whatever_layer()

Looks like disabling basemap isn't documented! :facepalm:.

Edit: no-token / invalid token "works" also, but you'll get an error in the js console.

options(rdeck.mapbox_access_token = "nope")
pts <- vctrs::data_frame(
  position = rdeck::xy(runif(1e4, -180, 180), runif(1e4, -90, 90))
)

rdeck::rdeck() |>
  rdeck::add_scatterplot_layer(data = pts, radius_min_pixels = 2)

anthonynorth avatar May 28 '24 00:05 anthonynorth

That's great, thanks. I look forward to trying it when the WMS layer is released.

jaredlander avatar May 30 '24 11:05 jaredlander