You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As a developer I can access the SourceCache in a Custom Layer, so that I don't have to reimplement the functionality for Custom Layers.
Rationale
As far as I am aware, Custom Layers have no access to SourceCache. Thus, when implementing a Custom Layer, the machinery around fetching and preparing tiles cannot be used and must be (re)implemented.
If a source property is provided on the custom layer, the relevant SourceCache should already be retrieved for the layer in painter.ts:
If it was added to this type, prerender and render would receive it as part of the args parameter. At the same time, it's worth passing Array<OverscaledTileID> from painter as well.
Impact
Any custom layers have to re-implement fetching, sorting, triangulating (if relevant) etc. the source data.
Happy to submit a PR on this if there isn't a better work around!
The text was updated successfully, but these errors were encountered:
The problem with exposing source cache to custom layer is the API surface and the need to maintain it.
You can see other PR around adding more fields to custom layer and the same problem around it.
I would advise to start with using internal fields and see if it's enough, otherwise, there will be a need to expose something a lot smaller...
User Story
As a developer I can access the
SourceCache
in a Custom Layer, so that I don't have to reimplement the functionality for Custom Layers.Rationale
As far as I am aware, Custom Layers have no access to
SourceCache
. Thus, when implementing a Custom Layer, the machinery around fetching and preparing tiles cannot be used and must be (re)implemented.If a
source
property is provided on the custom layer, the relevantSourceCache
should already be retrieved for the layer inpainter.ts
:maplibre-gl-js/src/render/painter.ts
Lines 655 to 681 in 11b34aa
Where it is going missing is in the
CustomRenderMethodInput
type indraw_custom.ts
:maplibre-gl-js/src/render/draw_custom.ts
Lines 8 to 64 in 11b34aa
If it was added to this type,
prerender
andrender
would receive it as part of the args parameter. At the same time, it's worth passingArray<OverscaledTileID>
from painter as well.Impact
Any custom layers have to re-implement fetching, sorting, triangulating (if relevant) etc. the source data.
Happy to submit a PR on this if there isn't a better work around!
The text was updated successfully, but these errors were encountered: