SymbolixAU / mapdeck

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

Mapbox vector tiles #346

Open dcooley opened 3 years ago

dcooley commented 3 years ago

https://deck.gl/docs/api-reference/geo-layers/mvt-layer

dwachsmuth commented 2 years ago

Hi @dcooley, I was wondering if there was a timeline for this feature showing up in a build? I'd love to kick the tires on it with some gigantic polygon datasets!

dcooley commented 2 years ago

The problem I am having with this is coming up with a clean way to pass in the colours / line widths / etc into the function. All the other layers that have a data argument map colours to a variable. Whereas for MVT you colour based on one of the JSON objects inside the MVT layer. Which in JS can also be a function, as per the example for getLineWidth

So this kind of fell of my radar because I couldn't come up with anything. I don't suppose you have any ideas?

mpadge commented 1 year ago

@dcooley I've been playing around with this, and it seems that the MVT layer is intended to use the external tile server specified in data as read only. You have to create and serve tiles elsewhere, and then plug the resultant URL in as the data parameter. deck.gl will then use the data specified in the tiles as expected. Both the deck.gl and mapbox libraries are hard-coded to accept data parameters as nothing other than URLs to tile servers.

The only way for this to all work without externally hosted tiles would be to use something like https://github.com/felt/tippecanoe to generate local tiles, then spin up a local server, and insert the URL from that. But that's never going to be viable here.

Short of that, the MVT layer is just a way of getting data from an external tile server and using that to constuct a deck.gl layer. From my understanding of it, locally-specified data can by definition not be used for MVT here.


Update

Implementation in rdeck described here, in which data is indeed just a URL to a tile server holding the data to be rendered. That would still be a nifty enhancement here!