Further Customization

A newer version of Maps for web SDK is available
A newer version of the SDK is available and is recommended for all users. Learn about the latest version, V2.0, in the Maps for web v2.0 documentation

Since we didn't provide flexible enough ability to customize popup, tooltips, marker, roads. (Which we are already working on in the next version) We'd like to introduce a way to do the customization in the current version.

Mapbox

NextBillion.ai Maps is built on top of the [email protected], So it's easy for you to do the further customization with mapbox.js. However, you need to avoid using APIs that are only supported by Mapbox2.0+.

Example

You can get the mabox map instance and use it like this:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta name="viewport" content="initial-scale=1.0" />
    <meta charset="UTF-8" />
    <title>Basic Map</title>
    <link href="https://maps-gl.nextbillion.io/maps/api/css" rel="stylesheet" />
    <style>
      * {
        margin: 0;
        padding: 0;
      }
      #map {
        width: 100vw;
        height: 100vh;
      }
    </style>
  </head>
  <body>
    <div id="map"></div>
    <script src="https://maps-gl.nextbillion.io/maps/api/js"></script>
    <script>
      nextbillion.apiKey = "your-api-key";
      var nbMap = new nextbillion.maps.Map(document.getElementById("map"), {
        zoom: 11,
        center: { lat: 1.3521, lng: 103.8198 }
      });
      // get the map instance of mapbox
      var mapBoxMap = nbMap.map;
      // draw an image with mapbox
      mapBoxMap.on("load", function () {
        mapBoxMap.loadImage("some-image-url", (error, image) => {
          if (error) throw error;
          // Add the image to the map style.
          mapBoxMap.addImage("some-image", image);
          // Add a data source
          mapBoxMap.addSource("point", {
            type: "geojson",
            data: {
              type: "FeatureCollection",
              features: [
                {
                  type: "Feature",
                  geometry: {
                    type: "Point",
                    coordinates: [103.8198, 1.4521]
                  }
                }
              ]
            }
          });
          // Add a layer to show the source
          mapBoxMap.addLayer({
            id: "points",
            type: "symbol",
            source: "point",
            layout: {
              "icon-image": "some-image",
              "icon-size": 0.4
            }
          });
        });
      });
    </script>
  </body>
</html>


Have Questions ?