GIS MAP Leaflet JS with API MAPBOX SAMPLE

Teddy Zugana
Jan 26, 2024

--

```

<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Multiple Marker LeafletJS</title>
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.6.0/dist/leaflet.css" integrity="sha512-xwE/Az9zrjBIphAcBb3F6JVqxf46+CDLwfLMHloNu6KEQCAWi6HcDUbeOfBIptF7tcCzusKFjFw2yuvEpDL9wQ==" crossorigin="">
<script src="https://unpkg.com/leaflet@1.6.0/dist/leaflet.js" integrity="sha512-gZwIG9x3wUXg2hdXF6+rVkLF/0Vi9U8D2Ntg4Ga5I5BZpVkVxlJWbSQtXPSiUTtC0TjtGOmxa1AJPuV0CPthew==" crossorigin=""></script>
<style>
html, body {
height: 100%;
margin: 0;
}

#map {
width: 600px;
height: 400px;
}

body {
padding: 0; margin: 0;
}

#map {
height: 100%; width: 100vw;
}
</style>
</head>
<body>
<div id="map"></div>
<script type="text/javascript">
var mymap = L.map('map', { zoomControl: false }).setView([-6.869544, 109.3948958], 13);

L.tileLayer('https://api.mapbox.com/styles/v1/{id}/tiles/{z}/{x}/{y}?access_token=sk.eyJ1Ijoia2V2aW5tZWwyMDAwIiwiYSI6ImNscnVjamoyZzA5M20ybXBxODg5ZzB4NnUifQ.YaAZJsy4wgx7bYpnvQFFaw', {
maxZoom: 18,
attribution: 'Map data © OpenStreetMap contributors.',
id: 'mapbox/streets-v11',
tileSize: 512,
zoomOffset: -1
}).addTo(mymap);

L.marker([-6.859829, 109.378317]).bindPopup('Pantai Widuri').addTo(mymap);
L.marker([-6.869374, 109.394864]).bindPopup('Nilla Collection').addTo(mymap);
L.marker([-6.890105, 109.380705]).bindPopup('Alun-Alun Pemalang').addTo(mymap);
L.marker([-6.888103, 109.386499]).bindPopup('Hotel Kencana Pemalang').addTo(mymap);
</script>
</body>
</html>
```

--

--