Skip to content

Conversation

@HarelM
Copy link
Collaborator

@HarelM HarelM commented Oct 15, 2025

Launch Checklist

This PR will introduce support for MLT format.

  • 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.
  • Write tests for all new functionality.
  • Add an entry to CHANGELOG.md under the ## main section.

@HarelM
Copy link
Collaborator Author

HarelM commented Oct 15, 2025

@Salkin975 I've opened the following branch for integration, and this PR to see that we keep this branch working and up-to-date with the main branch.:
https://github.com/maplibre/maplibre-gl-js/tree/mlt

I tried to copy over the code from your branch but I'm not sure this is the right approach to solve it.
Most of the code is duplicated between mlt and vector source when there's no real need to copy it.

I would recommend as an initial step to only try and make mlt work in maplibre without optimizing the buckets and other things.
Once we have it working with some basic tests for lines, fill, symbols etc, we can start implementing the optimizations that are needed.
What do you think?

@codecov
Copy link

codecov bot commented Oct 15, 2025

Codecov Report

❌ Patch coverage is 69.69697% with 30 lines in your changes missing coverage. Please review.
✅ Project coverage is 92.20%. Comparing base (e832ffa) to head (06d908b).
⚠️ Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
src/source/vector_tile_mlt.ts 67.04% 29 Missing ⚠️
src/source/vector_tile_worker_source.ts 80.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6570      +/-   ##
==========================================
- Coverage   92.29%   92.20%   -0.10%     
==========================================
  Files         283      284       +1     
  Lines       23558    23652      +94     
  Branches     5001     5025      +24     
==========================================
+ Hits        21744    21808      +64     
- Misses       1814     1844      +30     

☔ View full report in Codecov by Sentry.
📢 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 mentioned this pull request Oct 15, 2025
10 tasks
@socket-security
Copy link

socket-security bot commented Oct 15, 2025

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Added@​maplibre/​mlt@​1.1.0100100100100100

View full report

Salkin975 and others added 6 commits October 29, 2025 20:23
* add basic render tests for mlt feature rendering

* add city and country label rendering test

* change test path

* simplify styles

* simplify styles by removing feature filters

* removed allowed

---------

Co-authored-by: Niklas Greindl <niklas.greindl.@rohde-schwarz.com>
@HarelM
Copy link
Collaborator Author

HarelM commented Oct 29, 2025

Unfortunately, coverage report does not work on the worker as is, and there might be other configuration needed in order to make it work, but the code is fully covered.

@HarelM HarelM marked this pull request as ready for review October 29, 2025 19:20
@HarelM HarelM requested review from birkskyum and mwilsnd October 29, 2025 19:21
@HarelM
Copy link
Collaborator Author

HarelM commented Nov 2, 2025

For future reference, I've used the following page to check the geometry rendering and conversion,
I'll see if I can add some test to cover this functionality.

<!DOCTYPE html>
<html lang="en">
<head>
    <title>Display a map</title>
    <meta property="og:description" content="Initialize a map in an HTML element with MapLibre GL JS." />
    <meta charset='utf-8'>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel='stylesheet' href='../../dist/maplibre-gl.css' />
    <script src='../../dist/maplibre-gl-dev.js'></script>
    <style>
        body { margin: 0; padding: 0; }
        html, body, #map { height: 100%; }
    </style>
</head>
<body>
<div id="map"></div>
<script>
    const map = new maplibregl.Map({
        container: 'map', // container id
        style: 'https://harelm.github.io/demotiles/tiles-mlt/plain.json', // style URL
        center: [0, 0], // starting position [lng, lat]
        zoom: 1, // starting zoom
        maplibreLogo: true
    });

    map.once('load', () => {
        map.addSource('gj', {
            type: 'geojson',
            data: []
        });
        map.addLayer({
            id: 'filll',
            type: 'fill',
            source: 'gj',
            filter: ["==", "$type", "Polygon"],
            paint: {
                'fill-color': 'red'
            }
        });

        map.addLayer({
            id: 'lineee',
            type: 'line',
            source: 'gj',
            filter: ["==", "$type", "LineString"],
            paint: {
                'line-color': 'blue'
            }
        });

        map.addLayer({
            id: 'pointtt',
            type: 'circle',
            source: 'gj',
            filter: ["==", "$type", "Point"],
            paint: {
                'circle-color': 'green'
            }
        });

        map.on("mousemove", (e) => {
            const features = map.queryRenderedFeatures(e.point);
            if (features.length > 0) {
                console.log(features.map(f => f.geometry));
                map.getSource('gj').setData({ 
                    type: 'FeatureCollection',
                    features: features.filter(f => f.source !== 'gj')
                })
            }
        })
    })
</script>
</body>
</html>

@HarelM HarelM merged commit 689a3c2 into main Nov 8, 2025
27 checks passed
@HarelM HarelM deleted the mlt branch November 8, 2025 22:44
mmc1718 pushed a commit to mmc1718/maplibre-gl-js that referenced this pull request Nov 20, 2025
* Initial mlt support hack

* Update min test

* Update build test

* Use released package instead of mocks

* Update mlt package to latest version

* Fix lint

* Initial implementation

* Update package version

* Fix lint

* Update package and relevant code.

* Update mltpackage to latest

* Update mlt to latest version

* Add basic render tests for mlt (maplibre#6631)

* add basic render tests for mlt feature rendering

* add city and country label rendering test

* change test path

* simplify styles

* simplify styles by removing feature filters

* removed allowed

---------

Co-authored-by: Niklas Greindl <niklas.greindl.@rohde-schwarz.com>

* treat mlt as binary data

* Update mlt tiles

* Update changelog

* Update build size, this will probably change in next version of mlt

* Move mlt vector worker to parent directory.

* Add support for queryrenderedfeatures

* Update to latest mlt package

* Add tests to feature index.

* Fix lint, simplify test

* Add html example, still without an image.

* Update mlt to latest version

* Rename mlt to match other files in that folder

* Update expected bytes.

* Update link to where the style is.

* Add image for the docs

---------

Co-authored-by: Niklas Greindl <154528139+Salkin975@users.noreply.github.com>
Co-authored-by: Niklas Greindl <niklas.greindl.@rohde-schwarz.com>
melitele pushed a commit to melitele/maplibre-gl-js that referenced this pull request Jan 8, 2026
* Initial mlt support hack

* Update min test

* Update build test

* Use released package instead of mocks

* Update mlt package to latest version

* Fix lint

* Initial implementation

* Update package version

* Fix lint

* Update package and relevant code.

* Update mltpackage to latest

* Update mlt to latest version

* Add basic render tests for mlt (maplibre#6631)

* add basic render tests for mlt feature rendering

* add city and country label rendering test

* change test path

* simplify styles

* simplify styles by removing feature filters

* removed allowed

---------

Co-authored-by: Niklas Greindl <niklas.greindl.@rohde-schwarz.com>

* treat mlt as binary data

* Update mlt tiles

* Update changelog

* Update build size, this will probably change in next version of mlt

* Move mlt vector worker to parent directory.

* Add support for queryrenderedfeatures

* Update to latest mlt package

* Add tests to feature index.

* Fix lint, simplify test

* Add html example, still without an image.

* Update mlt to latest version

* Rename mlt to match other files in that folder

* Update expected bytes.

* Update link to where the style is.

* Add image for the docs

---------

Co-authored-by: Niklas Greindl <154528139+Salkin975@users.noreply.github.com>
Co-authored-by: Niklas Greindl <niklas.greindl.@rohde-schwarz.com>
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.

Support MapLibre Tiles (MLT)

5 participants