Closed dee-cf closed 8 months ago
Hi @codefactorydevelopment,
Thank you for using mapbox-gl-js.
on map events like zoom or pan, would source load 3 times (3 requests to the source url) because 3 layers use it or would there be a single request?
It would be a single request since all layers use the same source.
And, if its a single, is this a good performance optimization strategy where we want to minimize number of requests sent to our vector tile source?
Since it would be a single request, that would work for you if you want to minimize the number of requests.
For future "how do I" questions like this, please refer to our help documentation, and if you can't find the answer there, contact support. This issue tracker is for reporting bugs and feature requests.
You might also consider posting your question to https://stackoverflow.com/questions/tagged/mapbox-gl-js to ask the community for help.
We have a postGIS
ST_asMVT
function creating our vector tiles. We can create multi-layer tile server using that function. Lets say we create tiles with 3 layers:layer1, layer2, layer3
.On the mapbox component side, we could
addSource
pointing to our api that returns those vector tiles. Then we could add 3 layers where each would use same source and each would have havesource-layer
property pointing to different layer in vector tile.If I read documentation correctly, setting
source-layer
tolayer2
would show onlylayer2
from vector tile within that mapbox layer.Question is: on map events like
zoom
orpan
, would source load 3 times (3 requests to the source url) because 3 layers use it or would there be a single request?And, if its a single, is this a good performance optimization strategy where we want to minimize number of requests sent to our vector tile source?