• Optimization
  • Navigation
  • Tracking
  • Maps
  • Places

Migrate To V2

Introduction

NB Map Web SDK V2 enables more features and performance enhancements, and we won't update V1 anymore(except bug fixing), highly recommended to migrate from V1 to V2.

Get Web SDK v2

CDN

1<link href="https://maps-gl.nextbillion.io/maps/v2/api/css" rel="stylesheet"/>
2<script src="https://maps-gl.nextbillion.io/maps/v2/api/js"></script>

NPM

Install

1npm install @nbai/nbmap-gl

Import

1import "@nbai/nbmap-gl/dist/nextbillion.css"
2import nextbillion from "@nbai/nbmap-gl"

Map Init

The Way to Init a map has been changed a bit, check the example here.

Marker

new Marker. You can get Marker by nextbillion.maps.Marker or import { Marker } from "@nbai/nbmap-gl". Check the example here.

new Popup. You can get Popup by nextbillion.maps.Popup or import { Popup } from "@nbai/nbmap-gl". Check the example here.

Tooltip

Tooltip is removed. You can get tooltip by using Popup, check the example here.

Draw shapes

Circle, Polyline, Polygon are removed. You can draw shapes by Layer in V2, check the example here.

Theme

The built-in theme is removed.

API Service

Instead of Directions, we provide DirectionsService now, you can learn how to get and render the data in these examples:

Similarly, we will provide *Service for other APIs in new version. But for now, You may need to make the request according to the API docs by yourself in your code.