> For the complete documentation index, see [llms.txt](https://openai.gitbook.io/code-cheatsheets/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://openai.gitbook.io/code-cheatsheets/js/webjs/packages/mapbox.md).

# mapbox

## mapcreation

* Container is the id of the div in the code to put the map in
* All coords are \[long, lat]

```typescript
this.map = new mapboxgl.Map({
  container: 'map',
  style: 'mapbox://styles/trinakat/cjasrg0ui87hc2rmsomilefe3', // UCLA Campus Buildings (restricted by the border)
  // 'mapbox://styles/trinakat/cjashcgwq7rfo2srstatrxhyi', // UCLA Buildings
  // 'mapbox://styles/helarabawy/cj9tlpsgj339a2sojau0uv1f4',
  center: [this.lng, this.lat],
  maxBounds: [[-118.46, 34.056],[-118.428, 34.079]],
  zoom: 15,
  pitch: 60
});
```

## Events

`map.loaded()` return boolean is loaded

```typescript
  on(type, listener)
  off(type, listener)
  once(type, listener)
  fire(type, data?)
  listens(type)
```

## Obscure Bug

Are you getting NO MAP GL JS found, but copied the link exactly like they had it. Well then, here is the real link from the example.

```typescript
<link href='https://api.tiles.mapbox.com/mapbox-gl-js/v0.44.1/mapbox-gl.css' rel='stylesheet' />
```
