-
-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Great, thanks!
- Loading branch information
Showing
1 changed file
with
31 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,32 @@ | ||
## Using Leaflet? | ||
## Using Leaflet | ||
|
||
A Leaflet-based snippet is coming soon. | ||
[MapLibre GL Leaflet](https://github.com/maplibre/maplibre-gl-leaflet) provides a binding for Leaflet that allows you to add vector tile sources to the Leaflet map. | ||
|
||
Include the following links and scripts in your page: | ||
|
||
```html | ||
<!-- Leaflet --> | ||
<link rel="stylesheet" href="https://unpkg.com/leaflet/dist/leaflet.css" /> | ||
<script src="https://unpkg.com/leaflet/dist/leaflet.js"></script> | ||
|
||
<!-- Maplibre GL --> | ||
<link href="https://unpkg.com/maplibre-gl/dist/maplibre-gl.css" rel='stylesheet' /> | ||
<script src="https://unpkg.com/maplibre-gl/dist/maplibre-gl.js"></script> | ||
|
||
<!-- Maplibre GL Leaflet --> | ||
<script src="https://unpkg.com/@maplibre/maplibre-gl-leaflet/leaflet-maplibre-gl.js"></script> | ||
``` | ||
|
||
Initialize it to a div like this: | ||
|
||
```html | ||
<div id="map" style="width: 100%; height: 500px"></div> | ||
<script> | ||
const map = L.map('map') | ||
.setView([52.517, 13.388], 9.5) | ||
L.maplibreGL({ | ||
style: 'https://tiles.openfreemap.org/styles/liberty' | ||
}).addTo(map) | ||
</script> | ||
``` |