Gathering detailed insights and metrics for @maplibre/maplibre-gl-leaflet
Gathering detailed insights and metrics for @maplibre/maplibre-gl-leaflet
Gathering detailed insights and metrics for @maplibre/maplibre-gl-leaflet
Gathering detailed insights and metrics for @maplibre/maplibre-gl-leaflet
npm install @maplibre/maplibre-gl-leaflet
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
138 Stars
194 Commits
37 Forks
7 Watching
1 Branches
47 Contributors
Updated on 24 Nov 2024
Minified
Minified + Gzipped
JavaScript (89.92%)
HTML (10.08%)
Cumulative downloads
Total Downloads
Last day
15.6%
1,606
Compared to previous day
Last week
6.5%
8,267
Compared to previous week
Last month
15.3%
34,637
Compared to previous month
Last year
42%
273,843
Compared to previous year
3
1
This is a binding from MapLibre GL JS to the familiar Leaflet API. It was originally developed for Mapbox (https://github.com/mapbox/mapbox-gl-leaflet) and was migrated to MapLibre after Mapbox changed its license.
1 2var map = L.map('map').setView([38.912753, -77.032194], 15); 3L.marker([38.912753, -77.032194]) 4 .bindPopup("Hello <b>Leaflet GL</b>!<br>Whoa, it works!") 5 .addTo(map) 6 .openPopup(); 7var gl = L.maplibreGL({ 8 style: 'mapbox://styles/mapbox/bright-v8' 9}).addTo(map);
Note that you can use any vector tile source useable by maplibre-gl. For instance, you can use OSM2VectorTiles with:
1var gl = L.maplibreGL({ 2 style: 'https://api.maptiler.com/maps/topo/style.json?key=<YOUR_MAPTILER_API_KEY>' 3}).addTo(map);
Once you have created the leaflet layer, the maplibre-gl map object can be accessed using
1gl.getMaplibreMap().... 2// add a source to the maplibre-gl layer 3gl.getMaplibreMap().addSource({...})
Code for these examples is hosted in the examples folder
Add a script tag referencing maplibre-gl-leaflet after adding leaflet and maplibre-gl-js in your website:
1<!-- Leaflet --> 2<link rel="stylesheet" href="https://unpkg.com/leaflet@1.8.0/dist/leaflet.css" /> 3<script src="https://unpkg.com/leaflet@1.8.0/dist/leaflet.js"></script> 4 5<!-- Maplibre GL --> 6<link href="https://unpkg.com/maplibre-gl@2.2.1/dist/maplibre-gl.css" rel='stylesheet' /> 7<script src="https://unpkg.com/maplibre-gl@2.2.1/dist/maplibre-gl.js"></script> 8 9<script src="https://unpkg.com/@maplibre/maplibre-gl-leaflet@0.0.20/leaflet-maplibre-gl.js"></script>
This project makes it possible to easily add a maplibre-gl-js layer in your Leaflet map. When using maplibre-gl-leaflet, you won't be able to use some of the maplibre-gl-js features. Here are the main differences between a "pure" maplibre-gl-js map and a Leaflet map using maplibre-gl-leaflet:
On the bright side, the maplibre-gl-leaflet binding will allow you to use all the leaflet features and plugins.
If you only need the maplibre-gl-js features (adding a map with a mapbox-style, adding a GeoJSON, etc.), you are probably better off using it directly.
Please use the issue tracker to report any bugs or file feature requests. You can fork this jsfiddle template to reproduce a bug, then share the URL of your fork in the GitHub issue.
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
packaging workflow detected
Details
Reason
0 existing vulnerabilities detected
Reason
Found 15/23 approved changesets -- score normalized to 6
Reason
dependency not pinned by hash detected -- score normalized to 2
Details
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2024-11-18
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More