## Map

The `Map` object represents the map on your page. It exposes methods  
and properties that enable you to programmatically change the map,  
and fires events as users interact with it.  
  
You create a `Map` by specifying a `container` and other options.  
Then Nextbillion GL JS initializes the map on the page and returns your `Map`  
object.

### Constructor

| Name |  |
| --- | --- |
| Map | new Map(options: MapOptions)<br>  <br>Parameters<br>  <br>1.  options: MapOptions |

### Properties

| Name | Type |
| --- | --- |
| repaint | boolean |
| showCollisionBoxes | boolean |
| showOverdrawInspector | boolean |
| showPadding | boolean |
| showTileBoundaries | boolean |
| version | string |
| vertices | boolean |

### Methods

| Method |  |
| --- | --- |
| addControl | addControl(control: IControl, position: ControlPosition)<br>  <br>Parameters<br>  <br>1.  control: IControl<br>2.  position: ControlPosition<br>  <br>Return Value: [Map](#map)<br>  <br>Adds an IControl to the map, calling `control.onAdd(this)` . |
| addImage | addImage(id: string, image: ImageBitmap \| ImageData \| HTMLImageElement \| StyleImageInterface \| { data: Uint8Array \| Uint8ClampedArray,height: number,width: number }, options: Partial)<br>  <br>Parameters<br>  <br>1.  id: string<br>2.  image: ImageBitmap \| ImageData \| HTMLImageElement \| StyleImageInterface \| { data: Uint8Array \| Uint8ClampedArray,height: number,width: number }<br>3.  options: Partial<br>  <br>Return Value: [Map](#map)<br>  <br>Add an image to the style. This image can be displayed on the map like any other icon in the style's  <br>sprite using the image's ID with  <br>`icon-image` ,  <br>`background-pattern` ,  <br>`fill-pattern` ,  <br>or `line-pattern` .  <br>A Map.event event will be fired if there is not enough space in the sprite to add this image. |
| addLayer | addLayer(layer: CustomLayerInterface \| { source: string \| SourceSpecification }, beforeId: string)<br>  <br>Parameters<br>  <br>1.  layer: CustomLayerInterface \| { source: string \| SourceSpecification }<br>2.  beforeId: string<br>  <br>Return Value: [Map](#map)<br>  <br>Adds a Nextbillion style layer  <br>to the map's style.  <br>  <br>A layer defines how data from a specified source will be styled. Read more about layer types  <br>and available paint and layout properties in the Nextbillion Style Specification.  <br>  <br>TODO: JSDoc can't pass |
| addSource | addSource(id: string, source: SourceSpecification)<br>  <br>Parameters<br>  <br>1.  id: string<br>2.  source: SourceSpecification<br>  <br>Return Value: [Map](#map)<br>  <br>Adds a source to the map's style. |
| addSourceType | addSourceType(name: string, SourceType: any, callback: Callback)<br>  <br>Parameters<br>  <br>1.  name: string<br>2.  SourceType: any<br>3.  callback: Callback<br>  <br>Return Value: void<br>  <br>Adds a \[custom source type\](#Custom Sources), making it available for use with  <br>Map#addSource . |
| areTilesLoaded | areTilesLoaded()<br>  <br>  <br>Return Value: boolean<br>  <br>Returns a Boolean indicating whether all tiles in the viewport from all sources on  <br>the style are loaded. |
| calculateCameraOptionsFromTo | calculateCameraOptionsFromTo(from: [LngLat](./geography-and-geometry#lnglat), altitudeFrom: number, to: [LngLat](./geography-and-geometry#lnglat), altitudeTo: number)<br>  <br>Parameters<br>  <br>1.  from: [LngLat](./geography-and-geometry#lnglat)<br>2.  altitudeFrom: number<br>3.  to: [LngLat](./geography-and-geometry#lnglat)<br>4.  altitudeTo: number<br>  <br>Return Value: CameraOptions<br>  <br>Calculates pitch, zoom and bearing for looking at |
| cameraForBounds | cameraForBounds(bounds: LngLatBoundsLike, options: CameraForBoundsOptions)<br>  <br>Parameters<br>  <br>1.  bounds: LngLatBoundsLike<br>2.  options: CameraForBoundsOptions<br>  <br>Return Value: CenterZoomBearing |
| easeTo | easeTo(options: CenterZoomBearing, eventData: any)<br>  <br>Parameters<br>  <br>1.  options: CenterZoomBearing<br>2.  eventData: any<br>  <br>Return Value: [Map](#map)<br>  <br>Changes any combination of `center` , `zoom` , `bearing` , `pitch` , and `padding` with an animated transition  <br>between old and new values. The map will retain its current values for any  <br>details not specified in `options` .  <br>  <br>Note: The transition will happen instantly if the user has enabled  <br>the `reduced motion` accesibility feature enabled in their operating system,  <br>unless `options` includes `essential: true` . |
| fire | fire(event: string \| Event, properties: any)<br>  <br>Parameters<br>  <br>1.  event: string \| Event<br>2.  properties: any<br>  <br>Return Value: [Map](#map) |
| fitBounds | fitBounds(bounds: LngLatBoundsLike, options: FitBoundsOptions, eventData: any)<br>  <br>Parameters<br>  <br>1.  bounds: LngLatBoundsLike<br>2.  options: FitBoundsOptions<br>3.  eventData: any<br>  <br>Return Value: [Map](#map)<br>  <br>Pans and zooms the map to contain its visible area within the specified geographical bounds.  <br>This function will also reset the map's bearing to 0 if bearing is nonzero. |
| fitScreenCoordinates | fitScreenCoordinates(p0: PointLike, p1: PointLike, bearing: number, options: FitBoundsOptions, eventData: any)<br>  <br>Parameters<br>  <br>1.  p0: PointLike<br>2.  p1: PointLike<br>3.  bearing: number<br>4.  options: FitBoundsOptions<br>5.  eventData: any<br>  <br>Return Value: [Map](#map)<br>  <br>Pans, rotates and zooms the map to to fit the box made by points p0 and p1  <br>once the map is rotated to the specified bearing. To zoom without rotating,  <br>pass in the current map bearing. |
| flyTo | flyTo(options: FlyToOptions, eventData: any)<br>  <br>Parameters<br>  <br>1.  options: FlyToOptions<br>2.  eventData: any<br>  <br>Return Value: [Map](#map)<br>  <br>Changes any combination of center, zoom, bearing, and pitch, animating the transition along a curve that  <br>evokes flight. The animation seamlessly incorporates zooming and panning to help  <br>the user maintain her bearings even after traversing a great distance.  <br>  <br>Note: The animation will be skipped, and this will behave equivalently to `jumpTo`  <br>if the user has the `reduced motion` accesibility feature enabled in their operating system,  <br>unless 'options' includes `essential: true` . |
| getBearing | getBearing()<br>  <br>  <br>Return Value: number<br>  <br>Returns the map's current bearing. The bearing is the compass direction that is "up"; for example, a bearing  <br>of 90° orients the map so that east is up. |
| getBounds | getBounds()<br>  <br>  <br>Return Value: [LngLatBounds](./geography-and-geometry#lnglatbounds)<br>  <br>Returns the map's geographical bounds. When the bearing or pitch is non-zero, the visible region is not  <br>an axis-aligned rectangle, and the result is the smallest bounds that encompasses the visible region. |
| getCanvas | getCanvas()<br>  <br>  <br>Return Value: HTMLCanvasElement<br>  <br>Returns the map's `<canvas>` element. |
| getCanvasContainer | getCanvasContainer()<br>  <br>  <br>Return Value: HTMLElement<br>  <br>Returns the HTML element containing the map's `<canvas>` element.  <br>  <br>If you want to add non-GL overlays to the map, you should append them to this element.  <br>  <br>This is the element to which event bindings for map interactivity (such as panning and zooming) are  <br>attached. It will receive bubbled events from child elements such as the `<canvas>` , but not from  <br>map controls. |
| getCenter | getCenter()<br>  <br>  <br>Return Value: [LngLat](./geography-and-geometry#lnglat)<br>  <br>Returns the map's geographical centerpoint. |
| getContainer | getContainer()<br>  <br>  <br>Return Value: HTMLElement<br>  <br>Returns the map's containing HTML element. |
| getFeatureState | getFeatureState(feature: FeatureIdentifier)<br>  <br>Parameters<br>  <br>1.  feature: FeatureIdentifier<br>  <br>Return Value: any<br>  <br>Gets the `state` of a feature.  <br>A feature's `state` is a set of user-defined key-value pairs that are assigned to a feature at runtime.  <br>Features are identified by their `feature.id` attribute, which can be any number or string.  <br>  <br>_Note: To access the values in a feature's state object for the purposes of styling the feature, use the `feature-state` expression._ |
| getFilter | getFilter(layerId: string)<br>  <br>Parameters<br>  <br>1.  layerId: string<br>  <br>Return Value: none<br>  <br>Returns the filter applied to the specified style layer. |
| getLayer | getLayer(id: string)<br>  <br>Parameters<br>  <br>1.  id: string<br>  <br>Return Value: StyleLayer<br>  <br>Returns the layer with the specified ID in the map's style. |
| getLayoutProperty | getLayoutProperty(layerId: string, name: string)<br>  <br>Parameters<br>  <br>1.  layerId: string<br>2.  name: string<br>  <br>Return Value: any<br>  <br>Returns the value of a layout property in the specified style layer. |
| getLight | getLight()<br>  <br>  <br>Return Value: any<br>  <br>Returns the value of the light object. |
| getMaxBounds | getMaxBounds()<br>  <br>  <br>Return Value: [LngLatBounds](./geography-and-geometry#lnglatbounds)<br>  <br>Returns the maximum geographical bounds the map is constrained to, or `null` if none set. |
| getMaxPitch | getMaxPitch()<br>  <br>  <br>Return Value: number<br>  <br>Returns the map's maximum allowable pitch. |
| getMaxZoom | getMaxZoom()<br>  <br>  <br>Return Value: number<br>  <br>Returns the map's maximum allowable zoom level. |
| getMinPitch | getMinPitch()<br>  <br>  <br>Return Value: number<br>  <br>Returns the map's minimum allowable pitch. |
| getMinZoom | getMinZoom()<br>  <br>  <br>Return Value: number<br>  <br>Returns the map's minimum allowable zoom level. |
| getPadding | getPadding()<br>  <br>  <br>Return Value: PaddingOptions<br>  <br>Returns the current padding applied around the map viewport. |
| getPaintProperty | getPaintProperty(layerId: string, name: string)<br>  <br>Parameters<br>  <br>1.  layerId: string<br>2.  name: string<br>  <br>Return Value: unknown<br>  <br>Returns the value of a paint property in the specified style layer. |
| getPitch | getPitch()<br>  <br>  <br>Return Value: number<br>  <br>Returns the map's current pitch (tilt). |
| getPixelRatio | getPixelRatio()<br>  <br>  <br>Return Value: number<br>  <br>Returns the map's pixel ratio. |
| getRenderWorldCopies | getRenderWorldCopies()<br>  <br>  <br>Return Value: boolean<br>  <br>Returns the state of `renderWorldCopies` . If `true` , multiple copies of the world will be rendered side by side beyond -180 and 180 degrees longitude. If set to `false` :  <br>\- When the map is zoomed out far enough that a single representation of the world does not fill the map's entire  <br>container, there will be blank space beyond 180 and -180 degrees longitude.  <br>\- Features that cross 180 and -180 degrees longitude will be cut in two (with one portion on the right edge of the  <br>map and the other on the left edge of the map) at every zoom level. |
| getSource | getSource(id: string)<br>  <br>Parameters<br>  <br>1.  id: string<br>  <br>Return Value: Source<br>  <br>Returns the source with the specified ID in the map's style.  <br>  <br>This method is often used to update a source using the instance members for the relevant  <br>source type as defined in [Sources](#sources).  <br>For example, setting the `data` for a GeoJSON source or updating the `url` and `coordinates`  <br>of an image source. |
| getStyle | getStyle()<br>  <br>  <br>Return Value: StyleSpecification<br>  <br>Returns the map's Nextbillion style object, a JSON object which can be used to recreate the map's style. |
| getTerrain | getTerrain()<br>  <br>  <br>Return Value: TerrainSpecification<br>  <br>Get the terrain-options if terrain is loaded |
| getZoom | getZoom()<br>  <br>  <br>Return Value: number<br>  <br>Returns the map's current zoom level. |
| hasControl | hasControl(control: IControl)<br>  <br>Parameters<br>  <br>1.  control: IControl<br>  <br>Return Value: boolean<br>  <br>Checks if a control exists on the map. |
| hasImage | hasImage(id: string)<br>  <br>Parameters<br>  <br>1.  id: string<br>  <br>Return Value: boolean<br>  <br>Check whether or not an image with a specific ID exists in the style. This checks both images  <br>in the style's original sprite and any images  <br>that have been added at runtime using Map#addImage . |
| isEasing | isEasing()<br>  <br>  <br>Return Value: boolean |
| isMoving | isMoving()<br>  <br>  <br>Return Value: boolean<br>  <br>Returns true if the map is panning, zooming, rotating, or pitching due to a camera animation or user gesture. |
| isRotating | isRotating()<br>  <br>  <br>Return Value: boolean<br>  <br>Returns true if the map is rotating due to a camera animation or user gesture. |
| isSourceLoaded | isSourceLoaded(id: string)<br>  <br>Parameters<br>  <br>1.  id: string<br>  <br>Return Value: boolean<br>  <br>Returns a Boolean indicating whether the source is loaded. Returns `true` if the source with  <br>the given ID in the map's style has no outstanding network requests, otherwise `false` . |
| isStyleLoaded | isStyleLoaded()<br>  <br>  <br>Return Value: none<br>  <br>Returns a Boolean indicating whether the map's style is fully loaded. |
| isZooming | isZooming()<br>  <br>  <br>Return Value: boolean<br>  <br>Returns true if the map is zooming due to a camera animation or user gesture. |
| jumpTo | jumpTo(options: JumpToOptions, eventData: any)<br>  <br>Parameters<br>  <br>1.  options: JumpToOptions<br>2.  eventData: any<br>  <br>Return Value: [Map](#map)<br>  <br>Changes any combination of center, zoom, bearing, and pitch, without  <br>an animated transition. The map will retain its current values for any  <br>details not specified in `options` . |
| listImages | listImages()<br>  <br>  <br>Return Value: none<br>  <br>Returns an Array of strings containing the IDs of all images currently available in the map.  <br>This includes both images from the style's original sprite  <br>and any images that have been added at runtime using Map#addImage . |
| listens | listens(type: string)<br>  <br>Parameters<br>  <br>1.  type: string<br>  <br>Return Value: any<br>  <br>Returns a true if this instance of Evented or any forwardeed instances of Evented have a listener for the specified type. |
| loadImage | loadImage(url: string, callback: GetImageCallback)<br>  <br>Parameters<br>  <br>1.  url: string<br>2.  callback: GetImageCallback<br>  <br>Return Value: void<br>  <br>Load an image from an external URL to be used with Map#addImage . External  <br>domains must support [CORS](https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS). |
| loaded | loaded()<br>  <br>  <br>Return Value: boolean<br>  <br>Returns a Boolean indicating whether the map is fully loaded.  <br>  <br>Returns `false` if the style is not yet fully loaded,  <br>or if there has been a change to the sources or style that  <br>has not yet fully loaded. |
| moveLayer | moveLayer(id: string, beforeId: string)<br>  <br>Parameters<br>  <br>1.  id: string<br>2.  beforeId: string<br>  <br>Return Value: [Map](#map)<br>  <br>Moves a layer to a different z-position. |
| off | off(type: T, layer: string, listener: Function)<br>  <br>Parameters<br>  <br>1.  type: T<br>2.  layer: string<br>3.  listener: Function<br>  <br>Return Value: [Map](#map)<br>  <br>Removes an event listener for layer-specific events previously added with `Map#on` . |
| on | on(type: T, layer: string, listener: Function)<br>  <br>Parameters<br>  <br>1.  type: T<br>2.  layer: string<br>3.  listener: Function<br>  <br>Return Value: [Map](#map)<br>  <br>Adds a listener for events of a specified type, optionally limited to features in a specified style layer. |
| once | once(type: T, layer: string, listener: Function)<br>  <br>Parameters<br>  <br>1.  type: T<br>2.  layer: string<br>3.  listener: Function<br>  <br>Return Value: [Map](#map)<br>  <br>Adds a listener that will be called only once to a specified event type occurring on features in a specified style layer. |
| panBy | panBy(offset: PointLike, options: AnimationOptions, eventData: any)<br>  <br>Parameters<br>  <br>1.  offset: PointLike<br>2.  options: AnimationOptions<br>3.  eventData: any<br>  <br>Return Value: [Map](#map)<br>  <br>Pans the map by the specified offset. |
| panTo | panTo(lnglat: [LngLatLike](./geography-and-geometry#interface-lnglatlike), options: AnimationOptions, eventData: any)<br>  <br>Parameters<br>  <br>1.  lnglat: [LngLatLike](./geography-and-geometry#interface-lnglatlike)<br>2.  options: AnimationOptions<br>3.  eventData: any<br>  <br>Return Value: [Map](#map)<br>  <br>Pans the map to the specified location with an animated transition. |
| project | project(lnglat: [LngLatLike](./geography-and-geometry#interface-lnglatlike))<br>  <br>Parameters<br>  <br>1.  lnglat: [LngLatLike](./geography-and-geometry#interface-lnglatlike)<br>  <br>Return Value: Point<br>  <br>Returns a [Point](https://github.com/mapbox/point-geometry) representing pixel coordinates, relative to the map's `container` ,  <br>that correspond to the specified geographical location. |
| queryRenderedFeatures | queryRenderedFeatures(geometry: PointLike \| , options: any)<br>  <br>Parameters<br>  <br>1.  geometry: PointLike \|<br>2.  options: any<br>  <br>Return Value: none<br>  <br>Returns an array of MapGeoJSONFeature objects  <br>representing visible features that satisfy the query parameters. |
| querySourceFeatures | querySourceFeatures(sourceId: string, parameters: { filter: Array<any>,sourceLayer: string,validate: boolean })<br>  <br>Parameters<br>  <br>1.  sourceId: string<br>2.  parameters: { filter: Array<any>,sourceLayer: string,validate: boolean }<br>  <br>Return Value: none<br>  <br>Returns an array of MapGeoJSONFeature objects  <br>representing features within the specified vector tile or GeoJSON source that satisfy the query parameters. |
| redraw | redraw()<br>  <br>  <br>Return Value: [Map](#map)<br>  <br>Force a synchronous redraw of the map. |
| remove | remove()<br>  <br>  <br>Return Value: void<br>  <br>Clean up and release all internal resources associated with this map.  <br>  <br>This includes DOM elements, event bindings, web workers, and WebGL resources.  <br>  <br>Use this method when you are done using the map and wish to ensure that it no  <br>longer consumes browser resources. Afterwards, you must not call any other  <br>methods on the map. |
| removeControl | removeControl(control: IControl)<br>  <br>Parameters<br>  <br>1.  control: IControl<br>  <br>Return Value: [Map](#map)<br>  <br>Removes the control from the map. |
| removeFeatureState | removeFeatureState(target: FeatureIdentifier, key: string)<br>  <br>Parameters<br>  <br>1.  target: FeatureIdentifier<br>2.  key: string<br>  <br>Return Value: [Map](#map)<br>  <br>Removes the `state` of a feature, setting it back to the default behavior.  <br>If only a `target.source` is specified, it will remove the state for all features from that source.  <br>If `target.id` is also specified, it will remove all keys for that feature's state.  <br>If `key` is also specified, it removes only that key from that feature's state.  <br>Features are identified by their `feature.id` attribute, which can be any number or string. |
| removeImage | removeImage(id: string)<br>  <br>Parameters<br>  <br>1.  id: string<br>  <br>Return Value: void<br>  <br>Remove an image from a style. This can be an image from the style's original  <br>sprite or any images  <br>that have been added at runtime using Map#addImage . |
| removeLayer | removeLayer(id: string)<br>  <br>Parameters<br>  <br>1.  id: string<br>  <br>Return Value: [Map](#map)<br>  <br>Removes the layer with the given ID from the map's style.  <br>  <br>If no such layer exists, an `error` event is fired. |
| removeSource | removeSource(id: string)<br>  <br>Parameters<br>  <br>1.  id: string<br>  <br>Return Value: [Map](#map)<br>  <br>Removes a source from the map's style. |
| resetNorth | resetNorth(options: AnimationOptions, eventData: any)<br>  <br>Parameters<br>  <br>1.  options: AnimationOptions<br>2.  eventData: any<br>  <br>Return Value: [Map](#map)<br>  <br>Rotates the map so that north is up (0° bearing), with an animated transition. |
| resetNorthPitch | resetNorthPitch(options: AnimationOptions, eventData: any)<br>  <br>Parameters<br>  <br>1.  options: AnimationOptions<br>2.  eventData: any<br>  <br>Return Value: [Map](#map)<br>  <br>Rotates and pitches the map so that north is up (0° bearing) and pitch is 0°, with an animated transition. |
| resize | resize(eventData: any)<br>  <br>Parameters<br>  <br>1.  eventData: any<br>  <br>Return Value: [Map](#map)<br>  <br>Resizes the map according to the dimensions of its  <br>`container` element.  <br>  <br>Checks if the map container size changed and updates the map if it has changed.  <br>This method must be called after the map's `container` is resized programmatically  <br>or when the map is shown after being initially hidden with CSS. |
| rotateTo | rotateTo(bearing: number, options: AnimationOptions, eventData: any)<br>  <br>Parameters<br>  <br>1.  bearing: number<br>2.  options: AnimationOptions<br>3.  eventData: any<br>  <br>Return Value: [Map](#map)<br>  <br>Rotates the map to the specified bearing, with an animated transition. The bearing is the compass direction  <br>that is "up"; for example, a bearing of 90° orients the map so that east is up. |
| setBearing | setBearing(bearing: number, eventData: any)<br>  <br>Parameters<br>  <br>1.  bearing: number<br>2.  eventData: any<br>  <br>Return Value: [Map](#map)<br>  <br>Sets the map's bearing (rotation). The bearing is the compass direction that is "up"; for example, a bearing  <br>of 90° orients the map so that east is up.  <br>  <br>Equivalent to `jumpTo({bearing: bearing})` . |
| setCenter | setCenter(center: [LngLatLike](./geography-and-geometry#interface-lnglatlike), eventData: any)<br>  <br>Parameters<br>  <br>1.  center: [LngLatLike](./geography-and-geometry#interface-lnglatlike)<br>2.  eventData: any<br>  <br>Return Value: [Map](#map)<br>  <br>Sets the map's geographical centerpoint. Equivalent to `jumpTo({center: center})` . |
| setEventedParent | setEventedParent(parent: [Evented](./events#evented), data: any)<br>  <br>Parameters<br>  <br>1.  parent: [Evented](./events#evented)<br>2.  data: any<br>  <br>Return Value: [Map](#map)<br>  <br>Bubble all events fired by this instance of Evented to this parent instance of Evented. |
| setFeatureState | setFeatureState(feature: FeatureIdentifier, state: any)<br>  <br>Parameters<br>  <br>1.  feature: FeatureIdentifier<br>2.  state: any<br>  <br>Return Value: [Map](#map)<br>  <br>Sets the `state` of a feature.  <br>A feature's `state` is a set of user-defined key-value pairs that are assigned to a feature at runtime.  <br>When using this method, the `state` object is merged with any existing key-value pairs in the feature's state.  <br>Features are identified by their `feature.id` attribute, which can be any number or string.  <br>  <br>This method can only be used with sources that have a `feature.id` attribute. The `feature.id` attribute can be defined in three ways:  <br>\- For vector or GeoJSON sources, including an `id` attribute in the original data file.  <br>\- For vector or GeoJSON sources, using the `promoteId` option at the time the source is defined.  <br>\- For GeoJSON sources, using the `generateId` option to auto-assign an `id` based on the feature's index in the source data. If you change feature data using `map.getSource('some id').setData(..)` , you may need to re-apply state taking into account updated `id` values.  <br>  <br>_Note: You can use the `feature-state` expression to access the values in a feature's state object for the purposes of styling._ |
| setFilter | setFilter(layerId: string, filter: FilterSpecification, options: StyleSetterOptions)<br>  <br>Parameters<br>  <br>1.  layerId: string<br>2.  filter: FilterSpecification<br>3.  options: StyleSetterOptions<br>  <br>Return Value: [Map](#map)<br>  <br>Sets the filter for the specified style layer.  <br>  <br>Filters control which features a style layer renders from its source.  <br>Any feature for which the filter expression evaluates to `true` will be  <br>rendered on the map. Those that are false will be hidden.  <br>  <br>Use `setFilter` to show a subset of your source data.  <br>  <br>To clear the filter, pass `null` or `undefined` as the second parameter. |
| setLayerZoomRange | setLayerZoomRange(layerId: string, minzoom: number, maxzoom: number)<br>  <br>Parameters<br>  <br>1.  layerId: string<br>2.  minzoom: number<br>3.  maxzoom: number<br>  <br>Return Value: [Map](#map)<br>  <br>Sets the zoom extent for the specified style layer. The zoom extent includes the  <br>minimum zoom level  <br>and maximum zoom level)  <br>at which the layer will be rendered.  <br>  <br>Note: For style layers using vector sources, style layers cannot be rendered at zoom levels lower than the  <br>minimum zoom level of the _source layer_ because the data does not exist at those zoom levels. If the minimum  <br>zoom level of the source layer is higher than the minimum zoom level defined in the style layer, the style  <br>layer will not be rendered at all zoom levels in the zoom range. |
| setLayoutProperty | setLayoutProperty(layerId: string, name: string, value: any, options: StyleSetterOptions)<br>  <br>Parameters<br>  <br>1.  layerId: string<br>2.  name: string<br>3.  value: any<br>4.  options: StyleSetterOptions<br>  <br>Return Value: [Map](#map)<br>  <br>Sets the value of a layout property in the specified style layer. |
| setLight | setLight(light: LightSpecification, options: StyleSetterOptions)<br>  <br>Parameters<br>  <br>1.  light: LightSpecification<br>2.  options: StyleSetterOptions<br>  <br>Return Value: [Map](#map)<br>  <br>Sets the any combination of light values. |
| setMaxBounds | setMaxBounds(bounds: LngLatBoundsLike)<br>  <br>Parameters<br>  <br>1.  bounds: LngLatBoundsLike<br>  <br>Return Value: [Map](#map)<br>  <br>Sets or clears the map's geographical bounds.  <br>  <br>Pan and zoom operations are constrained within these bounds.  <br>If a pan or zoom is performed that would  <br>display regions outside these bounds, the map will  <br>instead display a position and zoom level  <br>as close as possible to the operation's request while still  <br>remaining within the bounds. |
| setMaxPitch | setMaxPitch(maxPitch: number)<br>  <br>Parameters<br>  <br>1.  maxPitch: number<br>  <br>Return Value: [Map](#map)<br>  <br>Sets or clears the map's maximum pitch.  <br>If the map's current pitch is higher than the new maximum,  <br>the map will pitch to the new maximum. |
| setMaxZoom | setMaxZoom(maxZoom: number)<br>  <br>Parameters<br>  <br>1.  maxZoom: number<br>  <br>Return Value: [Map](#map)<br>  <br>Sets or clears the map's maximum zoom level.  <br>If the map's current zoom level is higher than the new maximum,  <br>the map will zoom to the new maximum. |
| setMinPitch | setMinPitch(minPitch: number)<br>  <br>Parameters<br>  <br>1.  minPitch: number<br>  <br>Return Value: [Map](#map)<br>  <br>Sets or clears the map's minimum pitch.  <br>If the map's current pitch is lower than the new minimum,  <br>the map will pitch to the new minimum. |
| setMinZoom | setMinZoom(minZoom: number)<br>  <br>Parameters<br>  <br>1.  minZoom: number<br>  <br>Return Value: [Map](#map)<br>  <br>Sets or clears the map's minimum zoom level.  <br>If the map's current zoom level is lower than the new minimum,  <br>the map will zoom to the new minimum.  <br>  <br>It is not always possible to zoom out and reach the set `minZoom` .  <br>Other factors such as map height may restrict zooming. For example,  <br>if the map is 512px tall it will not be possible to zoom below zoom 0  <br>no matter what the `minZoom` is set to. |
| setPadding | setPadding(padding: PaddingOptions, eventData: any)<br>  <br>Parameters<br>  <br>1.  padding: PaddingOptions<br>2.  eventData: any<br>  <br>Return Value: [Map](#map)<br>  <br>Sets the padding in pixels around the viewport.  <br>  <br>Equivalent to `jumpTo({padding: padding})` . |
| setPaintProperty | setPaintProperty(layerId: string, name: string, value: any, options: StyleSetterOptions)<br>  <br>Parameters<br>  <br>1.  layerId: string<br>2.  name: string<br>3.  value: any<br>4.  options: StyleSetterOptions<br>  <br>Return Value: [Map](#map)<br>  <br>Sets the value of a paint property in the specified style layer. |
| setPitch | setPitch(pitch: number, eventData: any)<br>  <br>Parameters<br>  <br>1.  pitch: number<br>2.  eventData: any<br>  <br>Return Value: [Map](#map)<br>  <br>Sets the map's pitch (tilt). Equivalent to `jumpTo({pitch: pitch})` . |
| setPixelRatio | setPixelRatio(pixelRatio: number)<br>  <br>Parameters<br>  <br>1.  pixelRatio: number<br>  <br>Return Value: void<br>  <br>Sets the map's pixel ratio. This allows to override `devicePixelRatio` .  <br>After this call, the canvas' `width` attribute will be `container.clientWidth * pixelRatio`  <br>and its height attribute will be `container.clientHeight * pixelRatio` . |
| setRenderWorldCopies | setRenderWorldCopies(renderWorldCopies: boolean)<br>  <br>Parameters<br>  <br>1.  renderWorldCopies: boolean<br>  <br>Return Value: [Map](#map)<br>  <br>Sets the state of `renderWorldCopies` . |
| setStyle | setStyle(style: string \| StyleSpecification, options: StyleOptions)<br>  <br>Parameters<br>  <br>1.  style: string \| StyleSpecification<br>2.  options: StyleOptions<br>  <br>Return Value: [Map](#map)<br>  <br>Updates the map's Nextbillion style object with a new value.  <br>  <br>If a style is already set when this is used and options.diff is set to true, the map renderer will attempt to compare the given style  <br>against the map's current state and perform only the changes necessary to make the map style match the desired state. Changes in sprites  <br>(images used for icons and patterns) and glyphs (fonts for label text) **cannot** be diffed. If the sprites or fonts used in the current  <br>style and the given style are different in any way, the map renderer will force a full update, removing the current style and building  <br>the given one from scratch. |
| setTerrain | setTerrain(options: TerrainSpecification)<br>  <br>Parameters<br>  <br>1.  options: TerrainSpecification<br>  <br>Return Value: [Map](#map)<br>  <br>Loads a 3D terrain mesh, based on a "raster-dem" source. |
| setTransformRequest | setTransformRequest(transformRequest: RequestTransformFunction)<br>  <br>Parameters<br>  <br>1.  transformRequest: RequestTransformFunction<br>  <br>Return Value: [Map](#map)<br>  <br>Updates the requestManager's transform request with a new function |
| setZoom | setZoom(zoom: number, eventData: any)<br>  <br>Parameters<br>  <br>1.  zoom: number<br>2.  eventData: any<br>  <br>Return Value: [Map](#map)<br>  <br>Sets the map's zoom level. Equivalent to `jumpTo({zoom: zoom})` . |
| snapToNorth | snapToNorth(options: AnimationOptions, eventData: any)<br>  <br>Parameters<br>  <br>1.  options: AnimationOptions<br>2.  eventData: any<br>  <br>Return Value: [Map](#map)<br>  <br>Snaps the map so that north is up (0° bearing), if the current bearing is close enough to it (i.e. within the  <br>`bearingSnap` threshold). |
| stop | stop()<br>  <br>  <br>Return Value: [Map](#map)<br>  <br>Stops any animated transition underway. |
| triggerRepaint | triggerRepaint()<br>  <br>  <br>Return Value: void<br>  <br>Trigger the rendering of a single frame. Use this method with custom layers to  <br>repaint the map when the layer changes. Calling this multiple times before the  <br>next frame is rendered will still result in only a single frame being rendered. |
| unproject | unproject(point: PointLike)<br>  <br>Parameters<br>  <br>1.  point: PointLike<br>  <br>Return Value: [LngLat](./geography-and-geometry#lnglat)<br>  <br>Returns a LngLat representing geographical coordinates that correspond  <br>to the specified pixel coordinates. |
| updateImage | updateImage(id: string, image: ImageBitmap \| ImageData \| HTMLImageElement \| StyleImageInterface \| { data: Uint8Array \| Uint8ClampedArray,height: number,width: number })<br>  <br>Parameters<br>  <br>1.  id: string<br>2.  image: ImageBitmap \| ImageData \| HTMLImageElement \| StyleImageInterface \| { data: Uint8Array \| Uint8ClampedArray,height: number,width: number }<br>  <br>Return Value: [Map](#map)<br>  <br>Update an existing image in a style. This image can be displayed on the map like any other icon in the style's  <br>sprite using the image's ID with  <br>`icon-image` ,  <br>`background-pattern` ,  <br>`fill-pattern` ,  <br>or `line-pattern` . |
| zoomIn | zoomIn(options: AnimationOptions, eventData: any)<br>  <br>Parameters<br>  <br>1.  options: AnimationOptions<br>2.  eventData: any<br>  <br>Return Value: [Map](#map)<br>  <br>Increases the map's zoom level by 1. |
| zoomOut | zoomOut(options: AnimationOptions, eventData: any)<br>  <br>Parameters<br>  <br>1.  options: AnimationOptions<br>2.  eventData: any<br>  <br>Return Value: [Map](#map)<br>  <br>Decreases the map's zoom level by 1. |
| zoomTo | zoomTo(zoom: number, options: AnimationOptions, eventData: any)<br>  <br>Parameters<br>  <br>1.  zoom: number<br>2.  options: AnimationOptions<br>3.  eventData: any<br>  <br>Return Value: [Map](#map)<br>  <br>Zooms the map to the specified zoom level, with an animated transition. |

## Example

```ts
var map = new nextbillion.maps.Map({
  container: 'map',
  center: [-122.420679, 37.772537],
  zoom: 13,
  style: style_object,
  hash: true,
  transformRequest: (url, resourceType)=> {
    if(resourceType === 'Source' && url.startsWith('http://myHost')) {
      return {
       url: url.replace('http', 'https'),
       headers: { 'my-custom-header': true},
       credentials: 'include'  // Include cookies for cross-origin requests
     }
    }
  }
});
```
