Menu
Close

Get Catalog Feature Info

Sample Implementation

    
      
      <html>
        <head>
          <title>Get Catalog Feature Info</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;
          }
                    #auto {
            width: 318px;
            position: absolute;
            z-index: 999;
            font-size: 15px;
            padding: 10px;
            border: 1px solid #ddd;
            outline: none !important;
            top: 5px;
            border-radius: 10px;
            margin: 4px;
          }
          #search-btn {
            position: absolute;
            top: 5px;
            left: 320px;
            cursor: pointer;
            z-index: 999;
            font-size: 14px;
            padding: 10px;
            border: 1px solid #000000;
            outline: none !important;
            border-radius: 10px;
            margin: 6px;
          }      
          </style>
               <script src="https://apis.mappls.com/advancedmaps/api/<Token>/map_sdk?layer=vector&v=3.0&callback=initMap1"></script>
               <script src="https://embed.mappls.com/mgis_sdk/?v=1.0"></script>
            </head>
        <body>
              <input type="text" id="auto" name="auto" class="search-outer form-control as-input" placeholder="Enter Token" required="" spellcheck="false">
              <div id="map"></div>
              <button type="button" id="search-btn">Search</button>
                    
    <script>
        var map;
        var input = document.getElementById('auto');

        function initMap1() {
            map = new mappls.Map("map", {
                center: [28.063811665552436, 78.14155561709754],
                zoomControl: true,
                geolocation: false,
                fullscreenControl: false,
                zoom: 6,
            });
        }

        document.getElementById('search-btn').addEventListener('click', function() {
            if (input.value) {
                Token = input.value.trim();
                map.addListener('click', function(e) {
                    var point = map.project(e.lngLat);
                    var params = {
                        map: map,
                        datasetName: 'district',
                        dataStoreName: 'mmidatacatalog',
                        x: parseInt(point.x),
                        y: parseInt(point.y),
                        access_token: Token,
                        style: 'city',
                    };
                    mappls.getCatalogFeatureInfo(params, function(data) {
                        console.log(data);
                    });
                });
            } else {
                alert("Please enter token!");
            }
        });
    </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