Menu
Close

PlacePicker With Snap Entry

Sample Implementation

 

  <html>
  <head>
    <title>PlacePicker With Snap Entry</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="PlacePicker With Snap Entry">

        <script src="https://sdk.mappls.com/map/sdk/web?v=3.0&access_token=Token&callback=initMap1"></script>
          <script src="https://sdk.mappls.com/map/sdk/plugins?access_token=Token&v=3.0"></script>
          <style>
        body {
            margin: 0;
        }

        #map {
            width: 100%;
            height: 100vh;
            margin: 0;
            padding: 0;
        }
    </style>
    </head>

    <body>
        <div id="map"></div>
                <script>
            var map;

            function initMap1() {
                map = new mappls.Map("map", {
                    center: [28.5507160000001, 77.2689280000001],
                    zoom: 17,
                    geolocation: false,
                    fullscreenControl: false
                });

                map.addListener("load", function() {
                    /*Place Picker plugin initialization*/
                    var options = {
                        map: map,
                        header: true,
                        closeBtn: true,
                        pinImage: 'https://apis.mapmyindia.com/map_v3/1.png',
                        snapToEntry: true, // default false
                        snappingRadius: 50, // default 50 --> (snappingRadius > 10 and snappingRadius < 200)
                        entryMarkerStyle: {
                            size: 10, // default 10
                            color: 'blue', // default '#ff0000'
                            strokeWidth: 4, // default 2
                            strokeColor: '' // default '#ffffff' 
                        }
                    };
                    mappls.advancePlacePicker(options, callback);

                    function callback(data) {
                        picker = data;
                        console.log(picker);
                        setTimeout(() => {
                            if (picker.data) {
                                alert(picker.data.formatted_address);
                            }
                        }, 700);
                    }
                });
            }
        </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