walkerke / mapgl

R interface to Mapbox GL JS v3 and Maplibre GL JS
https://walker-data.com/mapgl
Other
84 stars 3 forks source link

Mapbox won't render in Quarto #3

Open walkerke opened 3 months ago

walkerke commented 3 months ago

At the moment, Quarto can't accommodate JS libraries served over a CDN because it expects a local resource path. Follow up on options for Mapbox GL JS re: licensing and how I can handle this.

walkerke commented 2 months ago

Following this discussion: https://github.com/quarto-dev/quarto-cli/discussions/10325

Also finding out if Mapbox GL JS can be bundled in the package from Mapbox which would solve the problem, so this issue's resolution is TBD.

walkerke commented 2 months ago

Now tracking at https://github.com/quarto-dev/quarto-cli/issues/10339

wiesehahn commented 5 days ago

so its still valid that we cant render mapgl in quarto, right? The title here suggests that this is true for Mapbox, but can it be done with maplibre? I get the same error when trying to render maplibre

Error in FUN(X[[i]], ...) : 
  Dependency mapbox-gl-draw 1.4.3 is not disk-based
Calls: .main ... dependencies_from_render -> html_dependencies_as_string -> lapply -> FUN
Execution halted

Is there any option to make this possible for maplibre (as I guess the license problem does not apply here)

walkerke commented 1 day ago

@wiesehahn yes, at the moment.

I was hoping the Quarto team would fix on their end as I prefer to pull in the assets via CDN given the way Mapbox GL JS is licensed. However it doesn't seem like the issue is high-priority.

What I can do for now is set up the MapLibre dependencies locally so it can be used in Quarto docs.

walkerke commented 1 day ago

@wiesehahn I've switched to local dependencies for MapLibre and successfully rendered a Quarto doc with all of those dependencies used. Install from GitHub and try this out:

---
title: "MapLibre Quarto test"
format: html
editor: visual
---

## MapLibre test

Let's try out MapLibre in a Quarto doc with a draw control and a geocoder, using all local dependencies:

```{r}
library(mapgl)

maplibre() |> 
  add_draw_control(freehand = TRUE) |> 
  add_geocoder_control()

image

wiesehahn commented 1 day ago

Great! thanks