Skip to content

Add a default marker

Add a default marker to the map.

<!DOCTYPE html>
<html lang="en">
    <title>Add a default marker</title>
    <meta property="og:description" content="Add a default marker to the map." />
    <meta charset='utf-8'>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel='stylesheet' href='' />
    <script src=''></script>
        body { margin: 0; padding: 0; }
        html, body, #map { height: 100%; }
<div id="map"></div>

    const map = new maplibregl.Map({
        container: 'map',
        center: [12.550343, 55.665957],
        zoom: 8

    const marker = new maplibregl.Marker()
        .setLngLat([12.550343, 55.665957])