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
NPM
Install
Import
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.
Popup
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.