qfes/rdeck

Support non-mapbox basemap layers

JosiahParry opened this issue · 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

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

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)

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

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! 🤦.

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)

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