Skip to content

[Maps] switch from mapbox-gl to maplibre-gl#85566

Closed
nreese wants to merge 9 commits intoelastic:masterfrom
nreese:maplibre
Closed

[Maps] switch from mapbox-gl to maplibre-gl#85566
nreese wants to merge 9 commits intoelastic:masterfrom
nreese:maplibre

Conversation

@nreese
Copy link
Copy Markdown
Contributor

@nreese nreese commented Dec 10, 2020

This PR switches from mapbox-gl to maplibre-gl. The first release of maplibre-gl is a drop in replacement for mapbox-gl 1.13.0.

Background

Mapbox v2.0 switched from an open source license to a closed source license requiring a mapbox subscription - mapbox/mapbox-gl-js#10162.

The mapbox subscription charges per map load event even if the map does not use any mapbox services. This means that any time a Map Embeddable is loaded by a user in Kibana, whether in observably, security, dashboard, canvas, or maps, that usage would count against this charge.

There is an effort to from a community to maintain an open source version at https://github.com/maplibre/maplibre-gl-js. We need to migrate our usage to this open source version.

@nreese nreese added chore WIP Work in progress Team:Geo Former Team Label for Geo Team. Now use Team:Presentation v8.0.0 release_note:skip Skip the PR/issue when compiling release notes v7.12.0 labels Dec 10, 2020
@elasticmachine
Copy link
Copy Markdown
Contributor

Pinging @elastic/kibana-gis (Team:Geo)

@snickell
Copy link
Copy Markdown

@nreese Thanks for trying this out, its encouraging to see more confirmation that this is a drop-in replacement.

Could you look at what I'm proposing doing in: maplibre/maplibre-gl-js#33

And let me know if that strikes you as something safe for your usage? I think I can do this with full compat, but I'm open to releasing v1.13.0 without this change too.

@nreese
Copy link
Copy Markdown
Contributor Author

nreese commented Dec 14, 2020

@elasticmachine merge upstream

@nreese nreese requested a review from a team February 20, 2021 16:11
@nreese nreese requested a review from a team as a code owner February 20, 2021 16:11
import mbWorkerUrl from '!!file-loader!maplibre-gl/dist/maplibre-gl-csp-worker';

mapboxgl.workerUrl = mbWorkerUrl;
mapboxgl.setRTLTextPlugin(mbRtlPlugin);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nreese maybe we can move that duplicated code into oss/map plugin and reexport it then.

// @ts-expect-error
import mbRtlPlugin from '!!file-loader!@mapbox/mapbox-gl-rtl-text/mapbox-gl-rtl-text.min.js';
// @ts-expect-error
import mbWorkerUrl from '!!file-loader!maplibre-gl/dist/maplibre-gl-csp-worker';

mapboxgl.workerUrl = mbWorkerUrl;
mapboxgl.setRTLTextPlugin(mbRtlPlugin);

@thomasneirynck thomasneirynck self-requested a review March 24, 2021 21:04
@nreese
Copy link
Copy Markdown
Contributor Author

nreese commented Mar 25, 2021

@elasticmachine merge upstream

@kibanamachine
Copy link
Copy Markdown
Contributor

kibanamachine commented Mar 25, 2021

💔 Build Failed

Failed CI Steps

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
visTypeVega 236 238 +2

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
maps 2.6MB 2.6MB +26.1KB
visTypeVega 2.6MB 2.6MB +33.3KB
total +59.4KB
Unknown metric groups

miscellaneous assets size

id before after diff
maps 979.2KB 979.2KB +4.0B
visTypeVega 0.0B 550.3KB ⚠️ +550.3KB
total +550.3KB

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

@nreese nreese added the v7.14.0 label Apr 20, 2021
@nreese
Copy link
Copy Markdown
Contributor Author

nreese commented Aug 18, 2021

Closed, replaced with #104505

@nreese nreese closed this Aug 18, 2021
@mistic mistic added v7.16.0 and removed v7.15.0 labels Aug 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

chore release_note:skip Skip the PR/issue when compiling release notes Team:Geo Former Team Label for Geo Team. Now use Team:Presentation v7.16.0 v8.0.0 WIP Work in progress

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants