NextBillion

NextBillion.ai web SDK Entry.

You need to use the singleton instance of this class by calling window.nextbillion if you load the sdk with CDN url.
Or you can get instance by import nextbillion from '@nbai/nbmap-gl' if you import the sdk with npm

Properties

NameType
apiHostnull | string
apiKeynull | string
versionstring

Methods

Method
DisableNBTransform

DisableNBTransform()



Return Value: void


Disable the inner request transform for NextBillion.ai maptiles. You only need to call this method if you want to use the maptiles not provided by nextbillion.ai.
EnableNBTransform

EnableNBTransform()



Return Value: void


Enable the inner request transform for NextBillion.ai maptiles.
setApiHost

setApiHost(host: null | string)


Parameters


  1. host: null | string

Return Value: void


Set the API host for the web SDK.
setApiKey

setApiKey(token: null | string)


Parameters


  1. token: null | string

Return Value: void


Set the API key for the web SDK.

NBMap

Constructor

Name
NBMap

new NBMap(options: NBMapOptions)


Parameters


  1. options: NBMapOptions

Properties

NameType
mapMap

Methods

Method
on

on(type: string, listener: Listener)


Parameters


  1. type: string
  2. listener: Listener

Return Value: NBMap


setStyle

setStyle(style: null | string | StyleSpecification, options: StyleOptions)


Parameters


  1. style: null | string | StyleSpecification
  2. options: StyleOptions

Return Value: NBMap


Example

1
nextbillion.setApiKey("your_api_key")
2
var map = new nextbillion.maps.Map({
3
container: 'map',
4
center: [-122.420679, 37.772537],
5
zoom: 13,
6
style: 'https://api.nextbillion.io/maps/streets/style.json',
7
hash: true,
8
});

Interface NBMapOptions

Properties

Name
style

Type: string | StyleSpecification


© 2024 NextBillion.ai all rights reserved.