2. Map creation
-const map = new MapLibreMap({
- container: 'map',
- style: 'https://tiles.openfreemap.org/styles/bright',
- center: [132.4553, 34.3966],
- zoom: 12
-});
+const map = L.map('map').setView([34.3966, 132.4553], 12);
+L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', {
+ maxZoom: 19,
+ attribution: '© <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>'
+}).addTo(map);
Coordinate order
MapLibre uses [lng, lat] while Leaflet uses [lat, lng]. This is the most common mistake when switching between the two.