Menu
Close

Add GeoJSON

Sample Implementation

    
      
      <html>
        <head>
          <title>Add GeoJSON</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;

        function initMap1() {
            map = new mappls.Map('map', {
                center: [28.61, 77.23],
                zoomControl: true,
                location: true
            });
            var mixjson = {
                "type": "FeatureCollection",
                "features": [{
                        "type": "Feature",
                        "geometry": {
                            "type": "Point",
                            "coordinates": [28.54950, 77.2678540]
                        },
                        "properties": {
                            "name": "MapmyIndia old Office",
                            "description": "Okhla delhi",
                            "icon": "https://apis.mapmyindia.com/map_v3/1.png",
                            "icon-size": 1,
                            "text": "",
                            "text-size": 20,
                            "text-offset": [0, 0],
                            "text-color": "red",
                        }
                    },
                    {
                        "type": "Feature",
                        "geometry": {
                            "type": "Point",
                            "coordinates": [28.5510446, 77.268952]
                        },
                        "properties": {
                            "name": "<div onclick=\"function1()\">MapmyIndia New Office</div>",
                            "description": "68,Okhla delhi",
                            "icon": "https://apis.mapmyindia.com/map_v3/1.png",
                            "icon-size": 0.55,
                            "text": "1",
                            "icon-offset": [0, -20],
                        }
                    },
                    {
                        "type": "Feature",
                        "geometry": {
                            "type": "LineString",
                            "coordinates": [
                                [28.551042, 77.268953],
                                [28.551005, 77.268649],
                                [28.550986, 77.268392],
                                [28.550967, 77.268231],
                                [28.550967, 77.268177],
                                [28.550958, 77.268016],
                                [28.55092, 77.267587],
                                [28.550722, 77.267651],
                                [28.55042, 77.267823],
                                [28.550128, 77.267802],
                                [28.549751, 77.267995],
                                [28.549652, 77.268039]
                            ]
                        },
                        "properties": {
                            "name": "Direction1",
                            "description": "Direction2",
                            "stroke": "#33CC00",
                            "stroke-opacity": 0.6509803921568628,
                            "stroke-width": 10,
                        }
                    },
                    {
                        "type": "Feature",
                        "geometry": {
                            "type": "Polygon",
                            "coordinates": [
                                [
                                    [28.550868798522835, 77.26878225803375],
                                    [28.550868798522835, 77.26899683475493],
                                    [28.550383454405356, 77.26903975009918],
                                    [28.550388166494926, 77.26883590221404]
                                ]
                            ]

                        },
                        "properties": {
                            "name": "MapmyIndia Head Office",
                            "stroke": "#33CC00",
                            "stroke-opacity": 0.6509803921568628,
                            "stroke-width": 3,
                            "fill": "#33CC00",
                            "fill-opacity": 0.6509803921568628
                        }
                    }
                ]
            };
            var jsonData = mappls.addGeoJson({
                map: map,
                data: mixjson,
                fitbounds: true
            });
        }
    </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