Skip to content

Passing tile data to CustomLayer class - #7913

Closed
Kanahiro wants to merge 10 commits into
maplibre:mainfrom
Kanahiro:custom-layer-tile
Closed

Passing tile data to CustomLayer class#7913
Kanahiro wants to merge 10 commits into
maplibre:mainfrom
Kanahiro:custom-layer-tile

Conversation

@Kanahiro

@Kanahiro Kanahiro commented Jul 12, 2026

Copy link
Copy Markdown
Contributor

Close #1305

Motivation

Recently I did experiment to render 3d models with lod aspects in GL JS.

Screenshot 2026-07-13 at 21 33 58https://kanahiro.github.io/maplibre-3dmodel/

Then I realized if custom layer can get tile data directly, codes would become more simpler and performance would be better by less copy. I remember some years ago I tried passing tile data to custom layer and now implement this.

Launch Checklist

  • Confirm your changes do not include backports from Mapbox projects (unless with compliant license) - if you are not sure about this, please ask!
  • Briefly describe the changes in this PR.
  • Link to related issues.
  • Include before/after visuals or gifs if this PR includes visual changes.
  • Write tests for all new functionality.
  • Document any changes to public APIs.
  • Post benchmark scores.
  • Add an entry to CHANGELOG.md under the ## main section.
  • Confirm you have read our AI policy here.

imagerender GLTF models based on point geometry and properties of features in vector tiles

Benchmark

npm run benchmark -- --compare main CustomLayer

> maplibre-gl@6.0.0-21 benchmark
> node --no-warnings --experimental-transform-types test/bench/run-benchmarks.ts --compare main CustomLayer

Starting headless chrome at: http://localhost:9966/test/bench/versions/index.html?compare=main
                                  main  custom-layer-tile f9b9a13 
 CustomLayer                0.3645 ms                  0.3623 ms       -0.0023 ms

AI usage disclosure

Codex GPT 5.6 Sol

@codecov

codecov Bot commented Jul 12, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.23%. Comparing base (59320f0) to head (718215a).
⚠️ Report is 8 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7913      +/-   ##
==========================================
+ Coverage   93.19%   93.23%   +0.04%     
==========================================
  Files         290      290              
  Lines       24652    24669      +17     
  Branches     6478     6484       +6     
==========================================
+ Hits        22975    23001      +26     
+ Misses       1677     1668       -9     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@HarelM

HarelM commented Jul 13, 2026

Copy link
Copy Markdown
Collaborator

Thanks for taking the time to open this PR!
I see the value for geojson and vector (although I think from a render perspective on the main thread they carry the same API, don't they?), but I'm not sure I understand the raster aspect of this change, I find the example a bit cryptic and I wonder if it's not easier to use addProtocol for raster manipulation?

Sharing a design document for this feature can be helpful I believe.

@HarelM

HarelM commented Jul 23, 2026

Copy link
Copy Markdown
Collaborator

Ping me when this is ready for review, currently in draft mode.

@Kanahiro

Copy link
Copy Markdown
Contributor Author

@HarelM sorry for late, and thank you for response!
I'd like to finish draft but how do you think this functionality passing tiledata? If it would make sense, I'll try to complete but if not, I think I could run this only in my fork.

@HarelM

HarelM commented Aug 4, 2026

Copy link
Copy Markdown
Collaborator

Looking at the code, it seems that this re-parses the tiles data before handing them.
I think you might be able to achieve the same behavior using the current public APIs, can't you?
Using coveringTiles should get you the relevant tiles, and querySourceFeatures should give you the current features that are loaded, right?

Let me know if I'm missing anything.

Sorry for the delay in response.

@Kanahiro

Kanahiro commented Aug 18, 2026

Copy link
Copy Markdown
Contributor Author

Thanks! I understand I can workaround in any way.

@Kanahiro Kanahiro closed this Aug 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Passing Tile-data to CustomLayer

2 participants