Skip to content

Marker

Add a marker to your map.

<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0" />
        <script src="https://cdn.smartmaps.cloud/packages/smartmaps/maps/umd/maps.min.js"></script>
        <style>
            body {
                margin: 0;
                padding: 0;
            }

            html,
            body,
            #map {
                height: 100%;
            }
        </style>
    </head>

    <body>
        <div id="map"></div>
        <script>
            const map = new smartmaps.maps.Map('map', 'INSERT API-KEY', {
                center: { lat: 49.02164948779226, lng: 8.439330018049352 },
                zoom: 15,
            });

            var icon = smartmaps.maps.icon({
                iconUrl: 'http://cdn.yellowmap.de/yellowmaps/img/marker.svg',
                iconRetinaUrl: 'http://cdn.yellowmap.de/yellowmaps/img/marker.svg',
                iconSize: [30, 49],
                iconAnchor: [15, 49],
                popupAnchor: [0, -48]
            });

            smartmaps.maps.marker({ lat: 49.02164948779226, lng: 8.439330018049352 }, { icon: icon }).addTo(map)
        </script>
    </body>
</html>