
Vue MapLibre
Vue.js wrapper for MapLibre GL JS
Maintained by razorness
Vue MapLibre GL offers Vue developers an easy way to integrate MapLibre GL JS maps into Vue applications with reactive data binding and Vue component architecture.
Quick start
npm install vue-maplibre-gl maplibre-gl@5 mitt geojson<script setup>
import { MglMap } from 'vue-maplibre-gl';
import 'maplibre-gl/dist/maplibre-gl.css';
import 'vue-maplibre-gl/dist/vue-maplibre-gl.css';
const style = 'https://tiles.openfreemap.org/styles/liberty';
const center = [0, 20];
const zoom = 2;
</script>
<template>
<div style="height: 400px">
<mgl-map :map-style="style" :center="center" :zoom="zoom" />
</div>
</template>›Setup noteschecked with v5.6.1
The peer dependencies are maplibre-gl ^5.17.0, mitt, and Vue 3.5, so install MapLibre GL JS v5 and mitt, and skip setWorkerUrl. Import both maplibre-gl.css and vue-maplibre-gl.css. The map fills its parent, so the parent needs a height. You can also register all components at once with app.use(VueMaplibreGl). Version 5.6.1 imports the geojson package in its build without declaring it, so install geojson as well or the bundler cannot resolve it.
Other platforms are on SDKs.