Menu
Close

TextOverlay Marker

Sample Implementation

    
      
      <html>
        <head>
          <title>TextOverlay Marker</title>
          <meta name="viewport" content="initial-scale=1.0">
          <meta charset="utf-8">
          <style>
          html,
          body,
          #map {
            margin: 0;
            padding: 0;
            width: 100%;
            height: 100vh;
          }
          </style>
             <script src="https://apis.mappls.com/advancedmaps/api/<Token>/map_sdk?layer=vector&v=3.0&callback=initMap1" defer async></script>
            </head>
        <body>
                    <div id="map"></div>
                        <script>
        var map, marker;

        function initMap1() {
            map = new mappls.Map("map", {
                center: [28.544, 77.5454],
                zoom: 9,
            });

            map.on("load", () => {
                var geoData = {
                    type: "FeatureCollection",
                    features: [{
                            type: "Feature",
                            properties: {
                                text: "Test-1",
                                "text-size": 14,
                                "text-offset": [0, -3],
                                "text-color": "red",
                                "stroke": "black",
                                "stroke-opacity": 1,
                                "stroke-width": 10,
                                "fill": "black",
                                "fill-opacity": 1,
                                icon: 'https://apis.mapmyindia.com/map_v3/2.png'
                            },
                            geometry: {
                                type: "Point",
                                coordinates: [77.5400, 28.504],
                            },
                        },
                        {
                            type: "Feature",
                            properties: {
                                text: "Test-2",
                                icon: 'https://apis.mapmyindia.com/map_v3/1.png'
                            },
                            geometry: {
                                type: "Point",
                                coordinates: [77.215812, 28.271812],
                            },
                        },
                        {
                            type: "Feature",
                            properties: {
                                text: "Test-3",
                                icon: 'https://apis.mapmyindia.com/map_v3/2.png'
                            },
                            geometry: {
                                type: "Point",
                                coordinates: [77.267823, 28.54923],
                            },
                        },
                        {
                            type: "Feature",
                            properties: {
                                text: "Test-4",
                                icon: 'https://apis.mapmyindia.com/map_v3/2.png'
                            },
                            geometry: {
                                type: "Point",
                                coordinates: [77.54543452, 28.54423],
                            },
                        },
                        {
                            type: "Feature",
                            properties: {
                                text: "Test-6",
                                "text-size": 14,
                                icon: 'https://apis.mapmyindia.com/map_v3/1.png'
                            },
                            geometry: {
                                type: "Point",
                                coordinates: [77.215800145, 28.270056],
                            },
                        },
                        {
                            type: "Feature",
                            properties: {
                                text: "Test-5",
                                "text-size": 14,
                                "text-offset": [0, -3],
                                "text-color": "blue",
                                icon: 'https://apis.mapmyindia.com/map_v3/1.png'
                            },
                            geometry: {
                                type: "Point",
                                coordinates: [77.21106, 28.5116],
                            },
                        },
                        {
                            type: "Feature",
                            properties: {
                                text: "noida",
                                "text-size": 14,
                                icon: 'https://apis.mapmyindia.com/map_v3/1.png'
                            },
                            geometry: {
                                type: "Point",
                                coordinates: [77.54, 28.54],
                            },
                        },
                        {
                            type: "Feature",
                            properties: {
                                text: "delhi",
                                "text-size": 14,
                                icon: 'https://apis.mapmyindia.com/map_v3/2.png'
                            },
                            geometry: {
                                type: "Point",
                                coordinates: [77.267, 28.549],
                            },
                        },
                    ],
                };

                marker = mappls.Marker({
                    map: map,
                    position: geoData,
                    fitbounds: true,
                    overlap: false,
                    cType: 1,
                    clusters: true,
                });
                marker.addListener('click', function(data) {
                    alert(data[0].properties.text);
                });
            });
        }
    </script>
        </body>
      </html>
      
      
      
    
  
Call at Mappls
Request Call Back

Personalisation SDK, by Mappls, is India's first O2O engagement tool that can 3X your customer engagement, retention and conversion.

There's so much that Mappls MapmyIndia can do for your enterprise or individual requirements. Explore our website to learn more or request a callback/email if you'd like us to connect with you.

or